67 lines
2.4 KiB
Python
67 lines
2.4 KiB
Python
from pydantic import BaseModel, Field, ConfigDict
|
|
from app.schemas.base import BaseSchema
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
#BOX
|
|
class BoxSchema(BaseSchema):
|
|
product_id: str = Field(..., title="Product ID")
|
|
type: str = Field(..., title="Box Type (collector, play, draft)")
|
|
set_code: str = Field(..., title="Set Code")
|
|
sku: Optional[str] = Field(None, title="SKU")
|
|
num_cards_expected: Optional[int] = Field(None, title="Number of cards expected")
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
# CREATE
|
|
# REQUEST
|
|
class CreateBoxRequest(BaseModel):
|
|
type: str = Field(..., title="Box Type (collector, play, draft)")
|
|
set_code: str = Field(..., title="Set Code")
|
|
sku: Optional[str] = Field(None, title="SKU")
|
|
num_cards_expected: Optional[int] = Field(None, title="Number of cards expected")
|
|
|
|
# RESPONSE
|
|
class CreateBoxResponse(BaseModel):
|
|
status_code: int = Field(..., title="status_code")
|
|
success: bool = Field(..., title="success")
|
|
box: list[BoxSchema] = Field(..., title="box")
|
|
|
|
# UPDATE
|
|
# REQUEST
|
|
class UpdateBoxRequest(BaseModel):
|
|
type: Optional[str] = Field(None, title="Box Type (collector, play, draft)")
|
|
set_code: Optional[str] = Field(None, title="Set Code")
|
|
sku: Optional[str] = Field(None, title="SKU")
|
|
num_cards_expected: Optional[int] = Field(None, title="Number of cards expected")
|
|
|
|
# GET
|
|
# RESPONSE
|
|
class GetBoxResponse(BaseModel):
|
|
status_code: int = Field(..., title="status_code")
|
|
success: bool = Field(..., title="success")
|
|
boxes: list[BoxSchema] = Field(..., title="boxes")
|
|
|
|
|
|
# OPEN BOX
|
|
class OpenBoxSchema(BaseModel):
|
|
id: str = Field(..., title="id")
|
|
num_cards_actual: Optional[int] = Field(None, title="Number of cards actual")
|
|
date_opened: Optional[datetime] = Field(None, title="Date Opened")
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
# CREATE
|
|
# REQUEST
|
|
class CreateOpenBoxRequest(BaseModel):
|
|
product_id: str = Field(..., title="Product ID")
|
|
file_ids: list[str] = Field(None, title="File IDs")
|
|
num_cards_actual: Optional[int] = Field(None, title="Number of cards actual")
|
|
date_opened: Optional [str] = Field(None, title="Date Opened")
|
|
|
|
# RESPONSE
|
|
class CreateOpenBoxResponse(BaseModel):
|
|
status_code: int = Field(..., title="status_code")
|
|
success: bool = Field(..., title="success")
|
|
open_box: list[OpenBoxSchema] = Field(..., title="open_box")
|