23 lines
735 B
Python
23 lines
735 B
Python
import motor.motor_asyncio
|
|
|
|
from beanie import init_beanie
|
|
|
|
from .user import User, AccessToken
|
|
from .entity.models import Entity
|
|
from .template.models import ContractTemplate, ProvisionTemplate
|
|
from .order.models import Order
|
|
from .contract.models import ContractDraft, Contract
|
|
|
|
DATABASE_URL = "mongodb://root:example@mongo:27017/"
|
|
|
|
|
|
async def init_db():
|
|
client = motor.motor_asyncio.AsyncIOMotorClient(
|
|
DATABASE_URL, uuidRepresentation="standard"
|
|
)
|
|
|
|
await init_beanie(database=client.db_name,
|
|
document_models=[User, AccessToken, Entity, ContractTemplate, ProvisionTemplate, ContractDraft,
|
|
Contract, ],
|
|
allow_index_dropping=True)
|