Add frontend project structure with React/TypeScript setup
This commit is contained in:
1 parent
c7abb73c66
commit
6914a6855c
58 files changed
+9056
-236
No files matched your search
@@ -0,0 +1,42 @@
|
||||
"""
|
||||
Pydantic schemas for Article model.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ArticleBase(BaseModel):
|
||||
"""Base article schema."""
|
||||
|
||||
title: str = Field(..., min_length=1, max_length=200)
|
||||
content: str = Field(..., min_length=1)
|
||||
|
||||
|
||||
class ArticleCreate(ArticleBase):
|
||||
"""Schema for creating a new article."""
|
||||
|
||||
author_id: int = Field(..., ge=1)
|
||||
category_id: int = Field(..., ge=1)
|
||||
|
||||
|
||||
class ArticleUpdate(BaseModel):
|
||||
"""Schema for updating an article."""
|
||||
|
||||
title: Optional[str] = Field(None, min_length=1, max_length=200)
|
||||
content: Optional[str] = Field(None, min_length=1)
|
||||
published: Optional[bool] = None
|
||||
|
||||
|
||||
class ArticleResponse(ArticleBase):
|
||||
"""Schema for article response."""
|
||||
|
||||
id: int
|
||||
author_id: int
|
||||
category_id: int
|
||||
created_at: datetime
|
||||
published: bool
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in new issue
Block a user