Bruno Charest 661d005fc7
Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
Add favorites feature with toggle filters, group management, color/icon pickers, dashboard widget, and star buttons across containers/docker sections with persistent storage and real-time UI updates
2025-12-23 14:56:31 -05:00

70 lines
1.7 KiB
Python

from __future__ import annotations
from datetime import datetime
from typing import Any, Optional
from pydantic import BaseModel, ConfigDict, Field
class FavoriteGroupCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=100)
sort_order: int = Field(0, ge=0)
color: Optional[str] = Field(None, max_length=20)
icon_key: Optional[str] = Field(None, max_length=100)
class FavoriteGroupUpdate(BaseModel):
name: Optional[str] = Field(None, min_length=1, max_length=100)
sort_order: Optional[int] = Field(None, ge=0)
color: Optional[str] = Field(None, max_length=20)
icon_key: Optional[str] = Field(None, max_length=100)
class FavoriteGroupOut(BaseModel):
id: int
name: str
sort_order: int
color: Optional[str] = None
icon_key: Optional[str] = None
created_at: datetime
updated_at: datetime
model_config = ConfigDict(from_attributes=True)
class FavoriteDockerContainerOut(BaseModel):
host_id: str
host_name: str
host_ip: str
host_docker_status: Optional[str] = None
container_id: str
name: str
image: Optional[str] = None
state: str
status: Optional[str] = None
health: Optional[str] = None
ports: Optional[dict[str, Any]] = None
compose_project: Optional[str] = None
class FavoriteContainerCreate(BaseModel):
host_id: str
container_id: str
group_id: Optional[int] = None
class FavoriteContainerOut(BaseModel):
id: int
group_id: Optional[int] = None
created_at: datetime
docker_container: FavoriteDockerContainerOut
class FavoriteContainersListResponse(BaseModel):
containers: list[FavoriteContainerOut]
class FavoriteGroupsListResponse(BaseModel):
groups: list[FavoriteGroupOut]