from motor.motor_asyncio import AsyncIOMotorDatabase import schemas from crud.base import CRUDBase __all__ = 'event_list', class EventMap(CRUDBase): async def save(self, db: AsyncIOMotorDatabase, data_in: schemas.Event_list): where = {'game': data_in.game} return await self.update_one(db, where, {'$set': data_in.dict(skip_defaults=True)}, upsert=True) async def get_list(self, db: AsyncIOMotorDatabase, game: str): where = {'game': game} res = await self.find_many(db, where,{'_id': 0}) return res async def get_select(self, db: AsyncIOMotorDatabase, data_in: schemas.SelectAttr, game: str): where = {'game': game, **data_in.dict()} res = await self.find_one(db, where, {'_id': 0}) return res event_list = EventMap('event_list')