From 577e157cd36b8211550b5d29b56731edd2c3643f Mon Sep 17 00:00:00 2001 From: Backend IM Bot <> Date: Sat, 22 Mar 2025 10:32:40 +0100 Subject: [PATCH] Update generated backend for blog_app with entities: posts, comments, tags, user --- __pycache__/main.cpython-312.pyc | Bin 1066 -> 1066 bytes app/api/core/dependencies/dependencies.py | 1 + .../__pycache__/__init__.cpython-312.pyc | Bin 197 -> 197 bytes .../activity_tracker.cpython-312.pyc | Bin 1179 -> 1138 bytes app/api/core/middleware/activity_tracker.py | 2 +- .../db/__pycache__/__init__.cpython-312.pyc | Bin 184 -> 184 bytes .../db/__pycache__/database.cpython-312.pyc | Bin 612 -> 612 bytes app/api/v1/models/comments.py | 4 +--- app/api/v1/models/posts.py | 7 ++++--- app/api/v1/models/tags.py | 5 +++-- app/api/v1/models/user.py | 18 ++++++++++-------- .../__pycache__/__init__.cpython-312.pyc | Bin 264 -> 264 bytes app/api/v1/schemas/comments.py | 7 ++++--- app/api/v1/schemas/posts.py | 2 +- app/api/v1/schemas/tags.py | 2 +- 15 files changed, 26 insertions(+), 22 deletions(-) diff --git a/__pycache__/main.cpython-312.pyc b/__pycache__/main.cpython-312.pyc index 5880babaed61cada0c55660fde488c7ec9c4ba19..ca7499393fcf0bc218239cd88e07dc767bccb99e 100644 GIT binary patch delta 22 ccmZ3*v5JHDG%qg~0}zBZ+)IDDkyn-l07TgaKL7v# delta 22 ccmZ3*v5JHDG%qg~0}zzg+)IDBkyn-l07cgZSpWb4 diff --git a/app/api/core/dependencies/dependencies.py b/app/api/core/dependencies/dependencies.py index 965f5ff..025ebc4 100644 --- a/app/api/core/dependencies/dependencies.py +++ b/app/api/core/dependencies/dependencies.py @@ -1,3 +1,4 @@ +# app/api/core/dependencies/dependencies.py from sqlalchemy.orm import Session from app.api.db.database import SessionLocal diff --git a/app/api/core/middleware/__pycache__/__init__.cpython-312.pyc b/app/api/core/middleware/__pycache__/__init__.cpython-312.pyc index ddfcb1b63fa535c1e77feb0320baddd92174efa9..72edb6f2df0f654ae89a22e498eb80a38fe2d79a 100644 GIT binary patch delta 19 ZcmX@gc$AU*G%qg~0}$+}yEl=07XUUK1@Qm? delta 19 ZcmX@gc$AU*G%qg~0}$x=-kr$33ji_O1v3Bu diff --git a/app/api/core/middleware/__pycache__/activity_tracker.cpython-312.pyc b/app/api/core/middleware/__pycache__/activity_tracker.cpython-312.pyc index 4901ad2599f874ad74e1bd55821e667d2ec3df98..2c7cc63251f07d12158afb94dccff1a438b45626 100644 GIT binary patch delta 373 zcmbQu`H6$~G%qg~0}$+}yO%CBkylbM49J0W{-P~ru{j|PT2qLP!tI=F5s>#PXBtZaH+*0h7;j=1#XvISfh#kD$k?r`w+b9ZuI z5Yt}avqSiTw(X9H3nFe;INWdWi+AvUU}ums`&G;jG_6U@k%Mstqaz#3Og%@A$(78S zGOQpc2m^_g44;7{Ly-`O-~2pE1izu>g6ugo;ZNi*iy+N>cTT pARa9)Vx26{A}P!Ul4i@vPcJPh1$(TBbFw#!KJ#4$(aE(easY;mW=;SA delta 434 zcmeywF`JY3G%qg~0}$x=-c1*q$ScVk1msL-NMT4}%wdR{XzszusLAmXq{44v|5AlL zK!!I1BTz*NBS;VgvLFj?SorC5{s77IwChz)4$Etbr@w0uprTP($?IcY_l zlLeXXWds5xUNHP8;{k~aB3@TGyl?P}ckq8;XOJ`dRm=}GwMoHIhH(+2 zqZG?x3rCsB{>+*(EI{ERVIZ-R;WLnAC=vn@9AIMd6lMhu5L1(@hD$#' \ No newline at end of file diff --git a/app/api/v1/models/tags.py b/app/api/v1/models/tags.py index 7d5ff60..8b8b44f 100644 --- a/app/api/v1/models/tags.py +++ b/app/api/v1/models/tags.py @@ -9,7 +9,8 @@ class Tags(Base): name = Column(String, nullable=False, unique=True) description = Column(Text, nullable=True) - posts = relationship("Post", back_populates="tags", secondary="post_tags") + # Relationships + posts = relationship('Post', secondary='post_tags', back_populates='tags') def __repr__(self): - return f"Tag(id={self.id}, name='{self.name}', description='{self.description}')" \ No newline at end of file + return f'Tag(id={self.id}, name="{self.name}")' \ No newline at end of file diff --git a/app/api/v1/models/user.py b/app/api/v1/models/user.py index 960dfe4..a1fdbb7 100644 --- a/app/api/v1/models/user.py +++ b/app/api/v1/models/user.py @@ -2,20 +2,22 @@ from sqlalchemy import Column, ForeignKey, Integer, String, Text from sqlalchemy.orm import relationship from app.api.db.database import Base +# Optional imports +# from typing import Optional + class User(Base): __tablename__ = 'user' id = Column(Integer, primary_key=True, index=True) - # Add relevant foreign keys and entity-specific fields here - # For example: - # email = Column(String, unique=True, index=True, nullable=False) - # hashed_password = Column(String, nullable=False) + # Add relevant columns based on project context + # email = Column(String, unique=True, nullable=False) + # password = Column(String, nullable=False) # full_name = Column(String, nullable=False) # bio = Column(Text, nullable=True) - # Relationships - # For example: + # Add relationships if applicable # posts = relationship("Post", back_populates="author") - def __repr__(self): - return f"User(id={self.id})" \ No newline at end of file + # Optional __repr__ method + # def __repr__(self): + # return f"User(id={self.id}, email='{self.email}', full_name='{self.full_name}')" \ No newline at end of file diff --git a/app/api/v1/routes/__pycache__/__init__.cpython-312.pyc b/app/api/v1/routes/__pycache__/__init__.cpython-312.pyc index 56b33e60c66e85473fac0a16c04b70802a5b061d..324c4ff9526b75aa7c668ef9f1401882dd612db7 100644 GIT binary patch delta 19 ZcmeBR>R{qN&CAQh00cYg?oH(W3ji(c1-t+N delta 19 ZcmeBR>R{qN&CAQh00cU|cPDcH1pq0m1pWX3 diff --git a/app/api/v1/schemas/comments.py b/app/api/v1/schemas/comments.py index 3b99865..4c8aa5e 100644 --- a/app/api/v1/schemas/comments.py +++ b/app/api/v1/schemas/comments.py @@ -1,14 +1,15 @@ from pydantic import BaseModel +from typing import Optional class CommentsBase(BaseModel): - comment_text: str + body: str post_id: int user_id: int class Comments(CommentsBase): id: int - post: dict - user: dict + post: Optional[dict] = None + user: Optional[dict] = None class Config: orm_mode = True \ No newline at end of file diff --git a/app/api/v1/schemas/posts.py b/app/api/v1/schemas/posts.py index 08bd7a6..14cb1e0 100644 --- a/app/api/v1/schemas/posts.py +++ b/app/api/v1/schemas/posts.py @@ -9,7 +9,7 @@ class PostsBase(BaseModel): class Posts(PostsBase): id: int - owner_id: int + user_id: int class Config: orm_mode = True \ No newline at end of file diff --git a/app/api/v1/schemas/tags.py b/app/api/v1/schemas/tags.py index 96e6d54..d35701c 100644 --- a/app/api/v1/schemas/tags.py +++ b/app/api/v1/schemas/tags.py @@ -6,7 +6,7 @@ class TagsBase(BaseModel): class Tags(TagsBase): id: int - name: str + posts: Optional[list] class Config: orm_mode = True \ No newline at end of file