from chain_service.database.database import Database class RunningChainRepository: def __init__(self, database: Database): self.collection = database.get_collection("running_chains") async def add(self, chain_id: str): query = payload = {"chainId": chain_id} await self.collection.replace_one(query, payload, upsert=True) async def exists(self, chain_id: str) -> bool: query = {"chainId": chain_id} return bool(await self.collection.find_one(query)) async def delete(self, chain_id: str): query = {"chainId": chain_id} await self.collection.delete_one(query)