36 lines
613 B
Python
36 lines
613 B
Python
from pydantic import BaseModel
|
|
from datetime import date
|
|
|
|
class UserCreate(BaseModel):
|
|
username: str
|
|
email: str
|
|
password_hash: str
|
|
|
|
class UserResponse(UserCreate):
|
|
id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class ArticleCreate(BaseModel):
|
|
title: str
|
|
content: str
|
|
author_id: int
|
|
|
|
class ArticleResponse(ArticleCreate):
|
|
id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class CommentCreate(BaseModel):
|
|
content: str
|
|
article_id: int
|
|
author_id: int
|
|
|
|
class CommentResponse(CommentCreate):
|
|
id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|