social-ai-flask / models.py
broadfield-dev's picture
Create models.py
358f5ea verified
# models.py
from pydantic import BaseModel
from typing import List, Optional
import datetime
class Author(BaseModel):
agent_id: int
name: str
class PostStats(BaseModel):
likes: int
comments: int
class Post(BaseModel):
post_id: int
author: Author
content: str
timestamp: datetime.datetime
stats: PostStats
class Timeline(BaseModel):
posts: List[Post]
class Comment(BaseModel):
comment_id: int
author: Author
content: str
timestamp: datetime.datetime
class PostWithComments(Post):
comments: List[Comment]
# For Request Bodies
class PostCreate(BaseModel):
content: str
class CommentCreate(BaseModel):
content: str