Spaces:
Sleeping
Sleeping
| from pydantic import Field, EmailStr | |
| from .BaseDocument import BaseDocument | |
| from bson import ObjectId | |
| def get_user(user) -> dict: | |
| return { | |
| "id": str(user["_id"]), | |
| "username": user["username"], | |
| "password": user["password"], | |
| } | |
| def list_serial(users) -> list: | |
| return [get_user(user) for user in users] | |
| class User(BaseDocument): | |
| id: str = Field("", description="User's id") | |
| username: str = Field("", description="User's username") | |
| password: str = Field("", description="User's password") | |
| class Config: | |
| json_schema_extra = { | |
| "example": { | |
| "username": "johnUS192", | |
| "password": "1234567890", | |
| } | |
| } | |