69 lines
1.1 KiB
Python
69 lines
1.1 KiB
Python
from pydantic import BaseModel
|
|
from typing import List, Optional
|
|
from datetime import datetime
|
|
|
|
|
|
class TagResponse(BaseModel):
|
|
id: int
|
|
name: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class DocumentResponse(BaseModel):
|
|
id: int
|
|
title: str
|
|
updated_at: datetime
|
|
tags: List[TagResponse] = []
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Istniejące modele Authorization
|
|
class InitRequest(BaseModel):
|
|
password: str
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
password: str
|
|
is_recovery: bool = False
|
|
|
|
|
|
# Modele Strony Głównej
|
|
|
|
|
|
class DocumentResponse(BaseModel):
|
|
id: int
|
|
title: str
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FolderResponse(BaseModel):
|
|
id: int
|
|
name: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FolderCreate(BaseModel):
|
|
name: str
|
|
parent_id: Optional[int] = None
|
|
|
|
|
|
class DashboardResponse(BaseModel):
|
|
folders: List[FolderResponse]
|
|
recent_documents: List[DocumentResponse]
|
|
|
|
|
|
class FolderContentResponse(BaseModel):
|
|
id: int
|
|
name: str
|
|
subfolders: List[FolderResponse]
|
|
documents: List[DocumentResponse]
|