You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
from typing import List, Optional
|
|
from uuid import UUID
|
|
|
|
from pydantic import Field
|
|
|
|
from src.masterdata.schema import MasterdataBase
|
|
from src.models import CommonParams, DefaultBase, Pagination
|
|
|
|
|
|
class MasterDataSimulationBase(MasterdataBase):
|
|
simulation_id: Optional[UUID] = Field(None, nullable=True)
|
|
|
|
|
|
class MasterDataSimulationCreate(MasterDataSimulationBase):
|
|
simulation_id: UUID = Field(..., nullable=False)
|
|
name: str = Field(..., nullable=True)
|
|
description: str = Field(..., nullable=True)
|
|
unit_of_measurement: str = Field(..., nullable=True)
|
|
value_num: float = Field(
|
|
..., nullable=True, le=1_000_000_000_000_000
|
|
)
|
|
value_str: str = Field(..., nullable=True)
|
|
seq: int = Field(..., nullable=True)
|
|
|
|
|
|
class MasterDataSimulationUpdate(MasterDataSimulationBase):
|
|
pass
|
|
|
|
|
|
class BulkMasterDataSimulationUpdate(DefaultBase):
|
|
simulation_id: UUID = Field(..., nullable=False)
|
|
updates: List[dict]
|
|
|
|
|
|
class MasterDataSimulationRead(MasterDataSimulationBase):
|
|
id: UUID
|
|
|
|
|
|
class MasterDataSimulationPagination(Pagination):
|
|
items: List[MasterDataSimulationRead] = []
|
|
|
|
|
|
class QueryParams(CommonParams):
|
|
simulation_id: UUID = Field(
|
|
...,
|
|
description="Simulation identifier",
|
|
)
|
|
items_per_page: Optional[int] = Field(
|
|
5,
|
|
ge=1,
|
|
description="Items per page"
|
|
)
|
|
search: Optional[str] = Field(None) |