gitscope
https://dev.kronoz.win/r/marzneshin.git
app/models/service.py · v0.5.6
Source
1 db68a58 Dawsh 2y ago from pydantic import ConfigDict, BaseModel, Field
2 a47eb4c Dawsh 2y ago
3 a47eb4c Dawsh 2y ago
4 db68a58 Dawsh 2y ago class Service(BaseModel):
5 db68a58 Dawsh 2y ago id: int | None = None
6 db68a58 Dawsh 2y ago name: str | None = Field(None)
7 a47eb4c Dawsh 2y ago model_config = ConfigDict(from_attributes=True)
8 a47eb4c Dawsh 2y ago
9 912788f Mardin 2y ago
10 db68a58 Dawsh 2y ago class ServiceCreate(Service):
11 db68a58 Dawsh 2y ago inbound_ids: list[int] = Field([])
12 01cdf2e Dawsh 2y ago model_config = ConfigDict(
13 01cdf2e Dawsh 2y ago json_schema_extra={
14 01cdf2e Dawsh 2y ago "example": {
15 01cdf2e Dawsh 2y ago "name": "my service 1",
16 db68a58 Dawsh 2y ago "inbound_ids": [1, 5, 9],
17 01cdf2e Dawsh 2y ago }
18 a47eb4c Dawsh 2y ago }
19 01cdf2e Dawsh 2y ago )
20 a47eb4c Dawsh 2y ago
21 a47eb4c Dawsh 2y ago
22 db68a58 Dawsh 2y ago class ServiceModify(Service):
23 db68a58 Dawsh 2y ago inbound_ids: list[int] | None = Field(None)
24 01cdf2e Dawsh 2y ago model_config = ConfigDict(
25 01cdf2e Dawsh 2y ago json_schema_extra={
26 f1ab16c Dawsh 2y ago "example": {
27 f1ab16c Dawsh 2y ago "id": 2,
28 f1ab16c Dawsh 2y ago "name": "my service 2",
29 f1ab16c Dawsh 2y ago "inbound_ids": [1, 2, 3],
30 f1ab16c Dawsh 2y ago }
31 a47eb4c Dawsh 2y ago }
32 01cdf2e Dawsh 2y ago )
33 a47eb4c Dawsh 2y ago
34 a47eb4c Dawsh 2y ago
35 a47eb4c Dawsh 2y ago class ServiceResponse(Service):
36 db68a58 Dawsh 2y ago inbound_ids: list[int]
37 db68a58 Dawsh 2y ago user_ids: list[int]
38 912788f Mardin 2y ago
39 a47eb4c Dawsh 2y ago model_config = ConfigDict(from_attributes=True)