69 lines
1.6 KiB
Python
69 lines
1.6 KiB
Python
"""
|
|
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
|
|
|
|
|
|
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
|
|
|
|
|
|
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
|