progress chain repository
This commit is contained in:
parent
1e34dc31e6
commit
cb1da6cdca
14
chain_service/repositories/progress_chain.py
Normal file
14
chain_service/repositories/progress_chain.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from chain_service.database.database import Database
|
||||
from chain_service.database.models.progress_chain import ProgressChain
|
||||
|
||||
|
||||
class ProgressChainRepository:
|
||||
|
||||
def __init__(self, database: Database):
|
||||
self.collection = database.get_collection("progress_chains")
|
||||
|
||||
async def upsert(self, progress_chain: ProgressChain) -> ProgressChain:
|
||||
query = {"_id": progress_chain.id}
|
||||
payload = progress_chain.model_dump(by_alias=True)
|
||||
await self.collection.replace_one(query, payload, upsert=True)
|
||||
return progress_chain
|
||||
Loading…
Reference in New Issue
Block a user