karl/app/api/models.py
2025-10-16 23:07:06 +02:00

59 lines
828 B
Python

from dataclasses import dataclass
from enum import Enum
from typing import List, Optional
@dataclass
class Request:
build_id: str
build_url: str
commit_id: str
commit_url: str
changelist: List[str]
@dataclass
class Response:
status: int
class EntryKind(str, Enum):
simple = "simple"
complex = "complex"
@dataclass
class EntrySimpleDTO:
key: str
value: str # mapowane na title/password
@dataclass
class EntryComplexDTO:
title: str
username: str
password: str
url: Optional[str] = None
notes: Optional[str] = None
@dataclass
class GroupDTO:
name: str
path: str
@dataclass
class EntryNodeDTO:
kind: EntryKind
title: str
path: str
@dataclass
class NodeDTO:
# Drzewo: grupa lub wpisy w grupach
name: str
path: str
groups: List["NodeDTO"]
entries: List[EntryNodeDTO]