Przykład

This commit is contained in:
s22775-pj-Oleksii-Sumrii
2026-04-18 18:43:26 +02:00
parent 840a6d6e56
commit 1963132132
61 changed files with 9872 additions and 2 deletions

68
backend/validation.py Normal file
View File

@@ -0,0 +1,68 @@
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]