39 lines
802 B
Python

Sure, here's the `user.py` file for the `app/api/v1/schemas/` directory in the `blog_app_igblf` FastAPI backend project:
from typing import Optional
from pydantic import BaseModel, EmailStr
class UserBase(BaseModel):
email: EmailStr
is_active: Optional[bool] = True
is_superuser: bool = False
full_name: Optional[str] = None
class UserCreate(UserBase):
password: str
class UserUpdate(UserBase):
password: Optional[str] = None
class UserInDBBase(UserBase):
id: Optional[int] = None
class Config:
orm_mode = True
class User(UserInDBBase):
pass
class UserInDB(UserInDBBase):
hashed_password: str
Here's a breakdown of the different schemas:
Note: Make sure to import the necessary dependencies (`typing`, `pydantic`) at the top of the file.