Przykład
This commit is contained in:
68
backend/validation.py
Normal file
68
backend/validation.py
Normal 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]
|
||||
Reference in New Issue
Block a user