Adding fits
This commit is contained in:
1 parent
8185f1f8b3
commit
ab39191af5
19 files changed
+1253
-1
No files matched your search
@@ -0,0 +1,60 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, field_validator
|
||||
|
||||
from app.models.fit import FitLabel
|
||||
from app.schemas.attachment_point import AttachmentPointRead
|
||||
|
||||
|
||||
class FitNoteCreate(BaseModel):
|
||||
body: str
|
||||
|
||||
@field_validator("body")
|
||||
@classmethod
|
||||
def validate_body(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("body must not be blank")
|
||||
return v.strip()
|
||||
|
||||
|
||||
class FitNoteRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
fit_id: int
|
||||
user_id: int | None
|
||||
username: str
|
||||
body: str
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class FitCreate(BaseModel):
|
||||
"""Manually-declared fit; recorded as Exact regardless of the match algorithm."""
|
||||
|
||||
attachment_point_a_id: int
|
||||
attachment_point_b_id: int
|
||||
|
||||
|
||||
class FitUpdate(BaseModel):
|
||||
label: FitLabel
|
||||
|
||||
|
||||
class FitRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
augmented_part_a_id: int
|
||||
augmented_part_b_id: int
|
||||
attachment_point_a_id: int
|
||||
attachment_point_b_id: int
|
||||
attachment_point_a: AttachmentPointRead
|
||||
attachment_point_b: AttachmentPointRead
|
||||
label: FitLabel
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
notes: list[FitNoteRead] = []
|
||||
|
||||
|
||||
class FitRecomputeResult(BaseModel):
|
||||
created: int
|
||||
removed: int
|
||||
Reference in new issue
Block a user