From 6b0a5a7b65105b9c7f3adf403c0dd7a713399e5e Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 13 Oct 2023 18:17:38 +0200 Subject: [PATCH] users repository --- app/models/users.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/users.py b/app/models/users.py index 36e15b1..743a924 100644 --- a/app/models/users.py +++ b/app/models/users.py @@ -1,18 +1,22 @@ from pydantic import BaseModel - +from pydantic_mongo import AbstractRepository, ObjectIdField class User(BaseModel): - id: int + id: ObjectIdField = None username: str password: str roles: str disabled: bool class UserOut(BaseModel): - id: int + id: ObjectIdField = None username: str roles: str disabled: bool class UserInDB(User): - password: str \ No newline at end of file + password: str + +class UserRepository(AbstractRepository[User]): + class Meta: + collection_name = "users" \ No newline at end of file