diff --git a/__pycache__/main.cpython-312.pyc b/__pycache__/main.cpython-312.pyc index 5880bab..ca74993 100644 Binary files a/__pycache__/main.cpython-312.pyc and b/__pycache__/main.cpython-312.pyc differ 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 ddfcb1b..72edb6f 100644 Binary files a/app/api/core/middleware/__pycache__/__init__.cpython-312.pyc and b/app/api/core/middleware/__pycache__/__init__.cpython-312.pyc differ 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 4901ad2..2c7cc63 100644 Binary files a/app/api/core/middleware/__pycache__/activity_tracker.cpython-312.pyc and b/app/api/core/middleware/__pycache__/activity_tracker.cpython-312.pyc differ diff --git a/app/api/core/middleware/activity_tracker.py b/app/api/core/middleware/activity_tracker.py index 46a0443..8c61125 100644 --- a/app/api/core/middleware/activity_tracker.py +++ b/app/api/core/middleware/activity_tracker.py @@ -9,5 +9,5 @@ class ActivityTrackerMiddleware(BaseHTTPMiddleware): start_time = time() response: Response = await call_next(request) process_time = time() - start_time - logger.info(f"Request processed in {process_time:.4f} seconds") + logger.info(f"Processed {request.method} {request.url} in {process_time:.4f} seconds") return response \ No newline at end of file diff --git a/app/api/db/__pycache__/__init__.cpython-312.pyc b/app/api/db/__pycache__/__init__.cpython-312.pyc index 8f6cdaf..0cb7f7f 100644 Binary files a/app/api/db/__pycache__/__init__.cpython-312.pyc and b/app/api/db/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/api/db/__pycache__/database.cpython-312.pyc b/app/api/db/__pycache__/database.cpython-312.pyc index 285a113..11d436a 100644 Binary files a/app/api/db/__pycache__/database.cpython-312.pyc and b/app/api/db/__pycache__/database.cpython-312.pyc differ diff --git a/app/api/v1/models/comments.py b/app/api/v1/models/comments.py index bd737a7..4ff0ea5 100644 --- a/app/api/v1/models/comments.py +++ b/app/api/v1/models/comments.py @@ -1,5 +1,3 @@ -# app/api/v1/models/comments.py - from sqlalchemy import Column, ForeignKey, Integer, String, Text from sqlalchemy.orm import relationship from app.api.db.database import Base @@ -12,7 +10,7 @@ class Comments(Base): user_id = Column(Integer, ForeignKey('users.id')) comment_text = Column(Text) created_at = Column(String) - updated_at = Column(String, nullable=True) + updated_at = Column(String) post = relationship('Post', back_populates='comments') user = relationship('User', back_populates='comments') diff --git a/app/api/v1/models/posts.py b/app/api/v1/models/posts.py index 91f73cb..14db0e3 100644 --- a/app/api/v1/models/posts.py +++ b/app/api/v1/models/posts.py @@ -1,4 +1,3 @@ -from typing import Optional from sqlalchemy import Column, ForeignKey, Integer, String, Text from sqlalchemy.orm import relationship from app.api.db.database import Base @@ -10,8 +9,10 @@ class Posts(Base): title = Column(String, nullable=False) content = Column(Text, nullable=False) user_id = Column(Integer, ForeignKey('users.id'), nullable=False) + category_id = Column(Integer, ForeignKey('categories.id'), nullable=False) - author = relationship('Users', back_populates='posts') + user = relationship('User', back_populates='posts') + category = relationship('Category', back_populates='posts') def __repr__(self): - return f'Post(id={self.id}, title={self.title}, content={self.content[:20]}...)' \ No newline at end of file + return f'' \ 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 56b33e6..324c4ff 100644 Binary files a/app/api/v1/routes/__pycache__/__init__.cpython-312.pyc and b/app/api/v1/routes/__pycache__/__init__.cpython-312.pyc differ 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