1
from datetime import datetime
2
from typing import Optional, List
4
from fastapi_filter.contrib.sqlalchemy import Filter
5
from pydantic.types import UUID4
7
from app.inventory.quant.models import Lot
8
from core.schemas import BaseFilter
9
from core.schemas.basic_schemes import BasicModel
10
from core.schemas.list_schema import GenericListSchema
11
from core.schemas.timestamps import TimeStampScheme
14
class LotBaseScheme(BasicModel):
15
vars: Optional[dict] = None
16
expiration_datetime: Optional[datetime] = None
18
external_number: Optional[str] = None
19
partner_id: Optional[UUID4] = None
23
from_attributes = True
25
service = 'app.inventory.quant.services.LotService'
29
class LotUpdateScheme(LotBaseScheme):
33
class LotCreateScheme(LotBaseScheme):
37
class LotScheme(LotCreateScheme, TimeStampScheme):
42
from_attributes = True
45
class LotFilter(BaseFilter):
47
populate_by_name = True
49
class Constants(Filter.Constants):
51
ordering_field_name = "order_by"
52
search_field_name = "search"
53
search_model_fields = ["external_number"]
56
class LotListSchema(GenericListSchema):
57
data: Optional[List[LotScheme]]