wip
This commit is contained in:
5
app/routers/models/__init__.py
Normal file
5
app/routers/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from .contact import Contact, ContactCreate, ContactUpdate
|
||||
from .location import Country, CountryCreate, CountryUpdate, LocationCode, LocationCodeCreate, Location, LocationCreate
|
||||
from .status import Status
|
||||
|
||||
|
||||
23
app/routers/models/contact.py
Normal file
23
app/routers/models/contact.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Annotated
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .status import Status
|
||||
|
||||
|
||||
class Contact(BaseModel):
|
||||
id: int
|
||||
code: str
|
||||
address: str | None
|
||||
notes: str | None
|
||||
status: Status | None
|
||||
|
||||
|
||||
class ContactCreate(BaseModel):
|
||||
code: str = Field(max_length=80)
|
||||
address: Annotated[str | None, Field(max_length=253)] = None
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class ContactUpdate(ContactCreate):
|
||||
code: Annotated[str | None, Field(max_length=80)] = None
|
||||
66
app/routers/models/location.py
Normal file
66
app/routers/models/location.py
Normal file
@@ -0,0 +1,66 @@
|
||||
from typing import Annotated
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .contact import Contact
|
||||
from .status import Status
|
||||
|
||||
|
||||
class Location(BaseModel):
|
||||
id: int
|
||||
code: str
|
||||
description: str | None
|
||||
notes: str | None
|
||||
status: Status
|
||||
contact: Contact | None
|
||||
|
||||
class LocationCreate(BaseModel):
|
||||
code: str = Field(max_length=30)
|
||||
description: Annotated[str | None, Field(max_length=80)] = None
|
||||
notes: str | None = None
|
||||
|
||||
class LocationUpdate(LocationCreate):
|
||||
code: Annotated[str | None, Field(max_length=30)] = None
|
||||
|
||||
|
||||
class LocationCode(BaseModel):
|
||||
id: int
|
||||
code: str
|
||||
description: str | None
|
||||
notes: str | None
|
||||
status: Status
|
||||
locations: list[Location]
|
||||
contact: Contact | None
|
||||
|
||||
class LocationCodeCreate(BaseModel):
|
||||
code: str = Field(max_length=8)
|
||||
description: Annotated[str | None, Field(max_length=80)] = None
|
||||
notes: str | None = None
|
||||
locations: list[LocationCreate] | None = None
|
||||
|
||||
|
||||
|
||||
class Country(BaseModel):
|
||||
id: int
|
||||
code: str
|
||||
name: str
|
||||
notes: str | None
|
||||
status: Status
|
||||
location_codes: list[LocationCode] | None
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CountryCreate(BaseModel):
|
||||
code: str = Field(max_length=2)
|
||||
name: str = Field(max_length=80)
|
||||
notes: str | None = None
|
||||
location_codes: list[LocationCodeCreate] | None = None
|
||||
|
||||
|
||||
class CountryUpdate(BaseModel):
|
||||
code: str | None = Field(default=None, max_length=2)
|
||||
name: str | None = Field(default=None, max_length=80)
|
||||
notes: str | None = None
|
||||
6
app/routers/models/status.py
Normal file
6
app/routers/models/status.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Status(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
Reference in New Issue
Block a user