31 lines
743 B
Python
31 lines
743 B
Python
Here's the `user.py` file that defines Pydantic schemas for the user model in the `app/api/v1/schemas/` directory of the `blog_app_igblf` FastAPI backend:
|
|
|
|
from typing import Optional
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
class UserBase(BaseModel):
|
|
email: EmailStr
|
|
is_active: Optional[bool] = True
|
|
is_superuser: Optional[bool] = False
|
|
full_name: Optional[str] = None
|
|
|
|
class UserCreate(UserBase):
|
|
password: str
|
|
|
|
class UserUpdate(UserBase):
|
|
password: Optional[str] = None
|
|
|
|
class User(UserBase):
|
|
id: int
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
This file defines the following Pydantic schemas:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: Make sure to import the necessary dependencies, such as `pydantic` and `typing`, at the top of the file. |