start
This commit is contained in:
0
backend/app/schemas/__init__.py
Normal file
0
backend/app/schemas/__init__.py
Normal file
6
backend/app/schemas/auth.py
Normal file
6
backend/app/schemas/auth.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Token(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
40
backend/app/schemas/box.py
Normal file
40
backend/app/schemas/box.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from app.schemas.object import ObjectSummary
|
||||
|
||||
|
||||
class BoxSummary(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
name: str
|
||||
|
||||
|
||||
class BoxCreate(BaseModel):
|
||||
name: str
|
||||
description: str | None = None
|
||||
parent_box_id: uuid.UUID | None = None
|
||||
|
||||
|
||||
class BoxUpdate(BaseModel):
|
||||
name: str | None = None
|
||||
description: str | None = None
|
||||
parent_box_id: uuid.UUID | None = None
|
||||
|
||||
|
||||
class BoxRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
name: str
|
||||
description: str | None
|
||||
parent_box_id: uuid.UUID | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
qr_code_url: str
|
||||
ancestors: list[BoxSummary]
|
||||
children: list[BoxSummary]
|
||||
objects: list[ObjectSummary]
|
||||
50
backend/app/schemas/object.py
Normal file
50
backend/app/schemas/object.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from app.schemas.photo import PhotoRead
|
||||
|
||||
|
||||
class ObjectSummary(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
inventory_number: str
|
||||
name: str
|
||||
|
||||
|
||||
class BoxRef(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
name: str
|
||||
|
||||
|
||||
class ObjectCreate(BaseModel):
|
||||
inventory_number: str
|
||||
name: str
|
||||
description: str | None = None
|
||||
box_id: uuid.UUID | None = None
|
||||
|
||||
|
||||
class ObjectUpdate(BaseModel):
|
||||
inventory_number: str | None = None
|
||||
name: str | None = None
|
||||
description: str | None = None
|
||||
box_id: uuid.UUID | None = None
|
||||
|
||||
|
||||
class ObjectRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
inventory_number: str
|
||||
name: str
|
||||
description: str | None
|
||||
box_id: uuid.UUID | None
|
||||
box: BoxRef | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
qr_code_url: str
|
||||
photos: list[PhotoRead]
|
||||
12
backend/app/schemas/photo.py
Normal file
12
backend/app/schemas/photo.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class PhotoRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
url: str
|
||||
content_type: str
|
||||
position: int
|
||||
Reference in New Issue
Block a user