Files

84 lines
1.7 KiB
Python

from datetime import datetime
from uuid import UUID
from ninja import Schema
class ScopeOut(Schema):
id: UUID
name: str
is_active: bool
created_at: datetime
class SyncScopesIn(Schema):
apibot_token: str | None = None
class SyncScopesOut(Schema):
# False when a sync loop was already running for this game
started: bool
class SyncScopesStopOut(Schema):
# False when no sync loop was running
stopped: bool
class SyncScopesStatusOut(Schema):
running: bool
has_token: bool
# Last AAndT status seen (e.g. "7inprog"), see games' AAndT status values
aandt_status: str | None = None
last_run_at: datetime | None = None
next_run_at: datetime | None = None
# Last run's error, if it failed
error: str | None = None
scope_count: int
active_scope_count: int
class ImageCropIn(Schema):
x1: int
y1: int
x2: int
y2: int
label: str | None = None
class ImageCropOut(Schema):
id: UUID
submission_file_id: UUID
x1: int
y1: int
x2: int
y2: int
label: str
ocr_status: str
ocr_raw_data: str
created_at: datetime
class SubmissionFileOut(Schema):
id: UUID
original_filename: str
content_type: str
file_size: int
file_url: str | None = None
ocr_status: str
ocr_raw_data: str
crops: list[ImageCropOut] = []
class SubmissionOut(Schema):
id: UUID
scope_id: UUID
username: str | None = None
notes: str | None = None
files: list[SubmissionFileOut] = []
created_at: datetime
updated_at: datetime
@staticmethod
def resolve_username(obj) -> str | None:
return obj.user.username if obj.user else None