Files
Gilles Soulier c67befc549 addon
2026-01-05 16:08:01 +01:00

75 lines
1.9 KiB
Python
Executable File

"""
Linux BenchTools - Device Schemas
"""
from pydantic import BaseModel
from typing import Optional, List
from app.schemas.benchmark import BenchmarkSummary
from app.schemas.hardware import HardwareSnapshotResponse
from app.schemas.document import DocumentResponse
class DeviceBase(BaseModel):
"""Base device schema"""
hostname: str
fqdn: Optional[str] = None
description: Optional[str] = None
asset_tag: Optional[str] = None
location: Optional[str] = None
owner: Optional[str] = None
tags: Optional[str] = None
purchase_store: Optional[str] = None
purchase_date: Optional[str] = None
purchase_price: Optional[float] = None
class DeviceCreate(DeviceBase):
"""Schema for creating a device"""
pass
class DeviceUpdate(BaseModel):
"""Schema for updating a device"""
hostname: Optional[str] = None
fqdn: Optional[str] = None
description: Optional[str] = None
asset_tag: Optional[str] = None
location: Optional[str] = None
owner: Optional[str] = None
tags: Optional[str] = None
purchase_store: Optional[str] = None
purchase_date: Optional[str] = None
purchase_price: Optional[float] = None
class DeviceSummary(DeviceBase):
"""Device summary for lists"""
id: int
created_at: str
updated_at: str
last_benchmark: Optional[BenchmarkSummary] = None
class Config:
from_attributes = True
class DeviceDetail(DeviceBase):
"""Detailed device information"""
id: int
created_at: str
updated_at: str
last_benchmark: Optional[BenchmarkSummary] = None
last_hardware_snapshot: Optional[HardwareSnapshotResponse] = None
documents: List[DocumentResponse] = []
class Config:
from_attributes = True
class DeviceListResponse(BaseModel):
"""Paginated device list response"""
items: List[DeviceSummary]
total: int
page: int
page_size: int