refactor: mixins for services

This commit is contained in:
2025-09-08 10:59:06 +04:00
parent 67634836dc
commit d73748deab
16 changed files with 207 additions and 205 deletions

View File

@ -14,6 +14,7 @@ class BaseSchema(BaseModel):
from_attributes = True
alias_generator = to_camel
populate_by_name = True
arbitrary_types_allowed = True
@classmethod
def from_sql_model(cls, model, fields: dict):

21
schemas/base_crud.py Normal file
View File

@ -0,0 +1,21 @@
from typing import TypeVar
from schemas.base import BaseResponse, BaseSchema
SchemaType = TypeVar("SchemaType", bound=BaseSchema)
class BaseGetAllResponse[SchemaType](BaseSchema):
items: list[SchemaType]
class BaseCreateResponse[SchemaType](BaseResponse):
entity: SchemaType
class BaseUpdateResponse(BaseResponse):
pass
class BaseDeleteResponse(BaseResponse):
pass