From 20c81dbd58ad1c8b280522c7ffe4d08bfa8540b9 Mon Sep 17 00:00:00 2001 From: IgorVolochay Date: Mon, 24 Feb 2025 17:50:28 +0300 Subject: [PATCH] feat: create card schema --- app/schemas/base_schemas.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/app/schemas/base_schemas.py b/app/schemas/base_schemas.py index 1940af1..2ade802 100644 --- a/app/schemas/base_schemas.py +++ b/app/schemas/base_schemas.py @@ -1,5 +1,5 @@ -from pydantic import BaseModel - +from pydantic import BaseModel, Field +from bson.objectid import ObjectId class User(BaseModel): user_id: int @@ -14,4 +14,26 @@ class User(BaseModel): disliked_post_ids: list[int] = list() comments_ids: list[int] = list() - registration_date: str \ No newline at end of file + registration_date: str + +class Card(BaseModel): + card_id: ObjectId = Field(alias="_id") + + choice_A: str + choice_B: str + + count_choice_A: int = 0 + count_choice_B: int = 0 + count_total: int = 0 + + count_likes: int = 0 + count_dislikes: int = 0 + comments: list[int] = list() + + author_id: int + creation_date: str + moderation_date: str = "Not moderated" + active_status: bool = False + + class Config: + arbitrary_types_allowed = True \ No newline at end of file