Importing RJSF lib with first application

This commit is contained in:
2025-04-07 22:54:05 +02:00
parent f93a59b27e
commit 661841ceef
19 changed files with 662 additions and 24 deletions

21
api/rpk-api/hub/db.py Normal file
View File

@@ -0,0 +1,21 @@
import os
from beanie import init_beanie
from motor.motor_asyncio import AsyncIOMotorClient
from hub.user import User
from hub.auth import AccessToken
from hub.firm import Firm
MONGO_USERNAME = os.getenv("MONGO_INITDB_ROOT_USERNAME")
MONGO_PASSWORD = os.getenv("MONGO_INITDB_ROOT_PASSWORD")
DATABASE_URL = f"mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@mongo:27017"
async def init_db():
client = AsyncIOMotorClient(DATABASE_URL, uuidRepresentation="standard")
await init_beanie(database=client.hub,
document_models=[User, AccessToken, Firm],
allow_index_dropping=True)