13 lines
384 B
Python
13 lines
384 B
Python
from chain_service.database.database import Database
|
|
from chain_service.database.models.chain import Chain
|
|
|
|
|
|
class ChainRepository:
|
|
|
|
def __init__(self, database: Database):
|
|
self.collection = database.get_collection("chains")
|
|
|
|
async def create(self, chain: Chain) -> Chain:
|
|
await self.collection.insert_one(chain.model_dump(by_alias=True))
|
|
return chain
|