add models

This commit is contained in:
Valentin CZERYBA 2023-10-10 22:39:23 +02:00
parent 524b4763b7
commit e28520a5fb
5 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,11 @@
from fastapi import FastAPI
from .routers import users
app = FastAPI()
app.include_router(users.router)
@app.get("/")
async def root():
return {"message": "Hello World !"}

0
app/models/__init__.py Normal file
View File

12
app/models/users.py Normal file
View File

@ -0,0 +1,12 @@
from pydantic import BaseModel
from pydantic_mongo import AbstractRepository, ObjectIdField
class Users(BaseModel):
id: ObjectIdField = None
username: str
class UsersRepository(AbstractRepository[Users]):
class Meta:
collection_name = users

0
app/routers/__init__.py Normal file
View File

View File

@ -1,2 +1,3 @@
fastapi fastapi
uvicorn[standard] uvicorn[standard]
pydantic-mongo