from typing import Optional, List from pydantic import BaseModel, EmailStr, Field class UserSchema(BaseModel): username: str = Field(...) email: str = Field(...) password: str = Field(...) projectname: List[str] projectpath: List[str] class Config: schema_extra = { "example": { "username": "John Doe", "email": "jdoe@x.edu.ng", "password": "Water resources engineering", "projectname": ["1", "2"], "projectpath": ["1", "2"], } } class UpdateUserModel(BaseModel): username: Optional[str] email: Optional[EmailStr] password: Optional[str] projectname: List[str] projectpath: List[str] class Config: schema_extra = { "example": { "username": "John Doe", "email": "jdoe@x.edu.ng", "password": "Water resources engineering", "projectname": ["1", "2"], "projectpath": ["1", "2"], } } def ResponseModel(data, message): return { "data": [data], "code": 200, "message": message, } def ErrorResponseModel(error, code, message): return {"error": error, "code": code, "message": message}