From 7d6c748045b394262847199c03bb80cc221be1b2 Mon Sep 17 00:00:00 2001 From: jiisanda Date: Sun, 15 Dec 2024 01:37:54 +0530 Subject: [PATCH 1/5] docuemnt comment table update --- README.md | 2 +- app/db/tables/auth/auth.py | 1 + app/db/tables/documents/documents_metadata.py | 29 ++++++++++++++++++- migrations/env.py | 3 ++ .../versions/2a02384ab925_initial_almebic.py | 14 ++++----- requirements.txt | 16 +++++----- 6 files changed, 48 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b277b8c..eeb2ee6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ DocFlow is a powerful Document Management API designed to streamline document ha ## 😎 Upcoming Updates -- 🟨 Document Interactions - Adding Comments and Tags +- 🟨 Document Interactions - Adding Comments - 🟨 Import documents from unread emails - 🟨 Video Preview - 🟨 Adding custom metadata fields to document diff --git a/app/db/tables/auth/auth.py b/app/db/tables/auth/auth.py index 625f2d9..b4b2adf 100644 --- a/app/db/tables/auth/auth.py +++ b/app/db/tables/auth/auth.py @@ -17,3 +17,4 @@ class User(Base): nullable=False, server_default=text('now()')) owner_of = relationship("DocumentMetadata", back_populates="owner") + comments = relationship("DocumentComment", back_populates="author") diff --git a/app/db/tables/documents/documents_metadata.py b/app/db/tables/documents/documents_metadata.py index b9b484b..0726a98 100644 --- a/app/db/tables/documents/documents_metadata.py +++ b/app/db/tables/documents/documents_metadata.py @@ -2,7 +2,7 @@ from uuid import uuid4 from typing import List, Optional -from sqlalchemy import Column, String, Integer, ARRAY, text, DateTime, Enum, ForeignKey, Table, UniqueConstraint +from sqlalchemy import Column, String, Integer, ARRAY, text, DateTime, Enum, ForeignKey, Table, UniqueConstraint, Text from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import Mapped, relationship @@ -42,3 +42,30 @@ class DocumentMetadata(Base): update_access = relationship("User", secondary=doc_user_access, passive_deletes=True) owner = relationship("User", back_populates="owner_of") + comments = relationship("DocumentComment", back_populates="document", cascade="all, delete-orphan") + + +class DocumentComment(Base): + __tablename__ = "document_comments" + + id: UUID = Column(UUID(as_uuid=True), default=uuid4, primary_key=True, index=True, nullable=False) + doc_id: UUID = Column(UUID(as_uuid=True), ForeignKey("document_metadata.id", ondelete="CASCADE")) + author_id: str = Column(String, ForeignKey("users.id"), nullable=False) + comment: str = Column(Text, nullable=False) + created_at = Column( + DateTime(timezone=True), + default=datetime.now(timezone.utc), + nullable=False, + server_default=text("NOW()") + ) + updated_at = Column( + DateTime(timezone=True), + default=datetime.now(timezone.utc), + onupdate=datetime.now(timezone.utc), + nullable=False, + server_default=text("NOW()") + ) + + document = relationship("DocumentMetadata", back_populates="comments") + author = relationship("User", back_populates="comments") + diff --git a/migrations/env.py b/migrations/env.py index 21f3484..cb182bb 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -21,7 +21,10 @@ # add your model's MetaData object here # for 'autogenerate' support +from app.db.tables.documents.documents_metadata import DocumentMetadata, DocumentComment +from app.db.tables.auth.auth import User from app.db.tables.documents.document_sharing import DocumentSharing +from app.db.tables.documents.notify import Notify target_metadata = Base.metadata diff --git a/migrations/versions/2a02384ab925_initial_almebic.py b/migrations/versions/2a02384ab925_initial_almebic.py index 58f1595..a07d278 100644 --- a/migrations/versions/2a02384ab925_initial_almebic.py +++ b/migrations/versions/2a02384ab925_initial_almebic.py @@ -21,14 +21,14 @@ def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('notify', - sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), - sa.Column('receiver_id', sa.String(), nullable=False), - sa.Column('message', sa.Text(), nullable=False), - sa.Column('status', sa.Enum('read', 'unread', name='notifyenum'), nullable=True), - sa.Column('notified_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False), - sa.PrimaryKeyConstraint('id') + sa.Column('id', sa.UUID(), autoincrement=False, nullable=False), + sa.Column('receiver_id', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('message', sa.TEXT(), autoincrement=False, nullable=False), + sa.Column('status', postgresql.ENUM('read', 'unread', name='notifyenum'), autoincrement=False, nullable=True), + sa.Column('notified_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False), + sa.PrimaryKeyConstraint('id', name='notify_pkey') ) - op.create_index(op.f('ix_notify_id'), 'notify', ['id'], unique=False) + op.create_index('ix_notify_id', 'notify', ['id'], unique=False) op.create_table('users', sa.Column('id', sa.String(length=26), nullable=False), sa.Column('username', sa.String(), nullable=False), diff --git a/requirements.txt b/requirements.txt index 82fcbbe..05cea07 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,19 @@ -alembic~=1.12.1 +alembic>=1.12.1 annotated-types==0.6.0 anyio==4.2.0 asyncpg==0.29.0 -boto3~=1.34.34 -botocore~=1.34.34 +boto3>=1.34.34 +botocore>=1.34.34 certifi==2024.7.4 click==8.1.7 colorama==0.4.6 dnspython>=2.6.1 email-validator==2.1.0.post1 -fastapi~=0.109.2 +fastapi>=0.109.2 greenlet==3.0.3 h11==0.14.0 httpcore==0.17.3 -httpx~=0.24.1 +httpx>=0.24.1 idna>=3.7 iniconfig==2.0.0 jmespath==1.0.1 @@ -27,9 +27,9 @@ pyasn1==0.5.1 pydantic~=2.5.3 pydantic-settings==2.1.0 pydantic_core==2.14.6 -pytest~=7.4.4 +pytest>=7.4.4 python-dateutil==2.8.2 -python-dotenv~=1.0.0 +python-dotenv>=1.0.0 python-jose==3.3.0 python-multipart>=0.0.18 python-ulid==2.2.0 @@ -37,7 +37,7 @@ rsa==4.9 s3transfer==0.10.0 six==1.16.0 sniffio==1.3.0 -SQLAlchemy~=1.4.51 +SQLAlchemy>=1.4.51 starlette>=0.40.0 typing_extensions==4.9.0 urllib3>=2.2.2 From 1586073a425347fdd989853b12a510f7d03c5846 Mon Sep 17 00:00:00 2001 From: jiisanda Date: Sun, 15 Dec 2024 01:55:07 +0530 Subject: [PATCH 2/5] document commment --- .../cb2ea87be0bd_document_comments.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 migrations/versions/cb2ea87be0bd_document_comments.py diff --git a/migrations/versions/cb2ea87be0bd_document_comments.py b/migrations/versions/cb2ea87be0bd_document_comments.py new file mode 100644 index 0000000..61ba5d7 --- /dev/null +++ b/migrations/versions/cb2ea87be0bd_document_comments.py @@ -0,0 +1,45 @@ +"""document comments + +Revision ID: cb2ea87be0bd +Revises: 2a02384ab925 +Create Date: 2024-12-15 01:24:30.954923 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision: str = 'cb2ea87be0bd' +down_revision: Union[str, None] = '2a02384ab925' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('document_comments', + sa.Column('id', sa.UUID(), nullable=False), + sa.Column('doc_id', sa.UUID(), nullable=True), + sa.Column('author_id', sa.String(), nullable=False), + sa.Column('comment', sa.Text(), nullable=False), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False), + sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), + sa.ForeignKeyConstraint(['doc_id'], ['document_metadata.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_document_comments_id'), 'document_comments', ['id'], unique=False) + op.drop_index('ix_notify_id', table_name='notify') + op.create_unique_constraint(None, 'share_url', ['url_id']) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint(None, 'share_url', type_='unique') + op.drop_index(op.f('ix_document_comments_id'), table_name='document_comments') + op.drop_table('document_comments') + # ### end Alembic commands ### From ea9b44157d5927755d6d6ef337fce3a32271c5f0 Mon Sep 17 00:00:00 2001 From: jiisanda Date: Fri, 27 Dec 2024 23:11:50 +0530 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=97=A8=EF=B8=8F=20comment=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/routes/documents/comments.py | 72 +++++++++++++++++++++++ app/db/repositories/documents/comments.py | 30 ++++++++++ app/schemas/documents/bands.py | 5 ++ app/schemas/documents/comments.py | 23 ++++++++ 4 files changed, 130 insertions(+) create mode 100644 app/api/routes/documents/comments.py create mode 100644 app/db/repositories/documents/comments.py create mode 100644 app/schemas/documents/comments.py diff --git a/app/api/routes/documents/comments.py b/app/api/routes/documents/comments.py new file mode 100644 index 0000000..86cf4e5 --- /dev/null +++ b/app/api/routes/documents/comments.py @@ -0,0 +1,72 @@ +from typing import List +from uuid import UUID + +from fastapi import APIRouter, status, Depends +from sqlalchemy.ext.asyncio import AsyncSession + +from app.api.dependencies.auth_utils import get_current_user +from app.api.dependencies.repositories import get_repository +from app.db.repositories.documents.comments import CommentRepository +from app.db.repositories.documents.documents import DocumentRepository +from app.schemas.auth.bands import TokenData +from app.schemas.documents.comments import CommentRead, CommentCreate, CommentUpdate + +router = APIRouter(tags=["Comments"]) + + +@router.post( + "/", + response_model=CommentRead, + status_code=status.HTTP_201_CREATED, + name="create_comment", +) +async def create_comment( + comment: CommentCreate, + user: TokenData = Depends(get_current_user), + doc_repo: DocumentRepository = Depends(get_repository(DocumentRepository)), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> CommentRead: + ... + + +@router.get( + "/{doc_id}", + response_model=List[CommentRead], + status_code=status.HTTP_200_OK, + name="get_comments", +) +async def get_document_comments( + doc_id: UUID, + user: TokenData = Depends(get_current_user), + doc_repo: DocumentRepository = Depends(get_repository(DocumentRepository)), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> List[CommentRead]: + ... + + +@router.put( + "/{comment_id}", + response_model=CommentRead, + status_code=status.HTTP_200_OK, + name="update_comment", +) +async def update_comment( + comment_id: UUID, + comment_update: CommentUpdate, + user: TokenData = Depends(get_current_user), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> CommentRead: + ... + + +@router.delete( + "/{comment_id}", + status_code=status.HTTP_204_NO_CONTENT, + name="delete_comment", +) +async def delete_comment( + comment_id: UUID, + user: TokenData = Depends(get_current_user), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> None: + ... diff --git a/app/db/repositories/documents/comments.py b/app/db/repositories/documents/comments.py new file mode 100644 index 0000000..2c42a50 --- /dev/null +++ b/app/db/repositories/documents/comments.py @@ -0,0 +1,30 @@ +from typing import Optional, List +from uuid import UUID + +from sqlalchemy.ext.asyncio import AsyncSession + +from app.db.tables.documents.documents_metadata import DocumentComment +from app.schemas.documents.comments import CommentCreate, CommentUpdate + + +class CommentRepository: + def __init__(self, session: AsyncSession): + self.session = session + + async def create(self, comment: CommentCreate, author_id: str) -> DocumentComment: + ... + + async def get(self, comment_id: UUID) -> Optional[DocumentComment]: + ... + + async def get_document_comments(self, doc_id: UUID) -> List[DocumentComment]: + ... + + async def update(self, comment_id: UUID, comment_update: CommentUpdate) -> Optional[DocumentComment]: + ... + + async def delete(self, comment_id: UUID) -> bool: + ... + + async def user_can_modify(self, comment_id: UUID, user_id: str) -> bool: + ... diff --git a/app/schemas/documents/bands.py b/app/schemas/documents/bands.py index 2ff7623..b3f8af3 100644 --- a/app/schemas/documents/bands.py +++ b/app/schemas/documents/bands.py @@ -67,3 +67,8 @@ class Notification(BaseModel): class NotifyPatchStatus(BaseModel): status: NotifyEnum = NotifyEnum.unread mark_all: bool = False + + +# comments +class CommentBase(BaseModel): + comment: str diff --git a/app/schemas/documents/comments.py b/app/schemas/documents/comments.py new file mode 100644 index 0000000..82cebce --- /dev/null +++ b/app/schemas/documents/comments.py @@ -0,0 +1,23 @@ +from datetime import datetime +from uuid import UUID + +from app.schemas.documents.bands import CommentBase + + +class CommentCreate(CommentBase): + doc_id: UUID + + +class CommentUpdate(CommentBase): + ... + + +class CommentRead(CommentBase): + id: UUID + doc_id: UUID + author_id: str + created_at: datetime + updated_at: datetime + + class Config: + from_attribute = True From ad6891b54bf336f41372b483b18b6925412a275a Mon Sep 17 00:00:00 2001 From: jiisanda Date: Fri, 27 Dec 2024 23:23:59 +0530 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9A=AB=20black=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/routes/documents/comments.py | 43 +++++++-------- app/db/repositories/documents/comments.py | 22 ++++---- app/db/tables/documents/documents_metadata.py | 19 ++++--- app/schemas/documents/comments.py | 3 +- .../cb2ea87be0bd_document_comments.py | 55 +++++++++++++------ 5 files changed, 79 insertions(+), 63 deletions(-) diff --git a/app/api/routes/documents/comments.py b/app/api/routes/documents/comments.py index 86cf4e5..3bb0686 100644 --- a/app/api/routes/documents/comments.py +++ b/app/api/routes/documents/comments.py @@ -2,7 +2,6 @@ from uuid import UUID from fastapi import APIRouter, status, Depends -from sqlalchemy.ext.asyncio import AsyncSession from app.api.dependencies.auth_utils import get_current_user from app.api.dependencies.repositories import get_repository @@ -21,12 +20,11 @@ name="create_comment", ) async def create_comment( - comment: CommentCreate, - user: TokenData = Depends(get_current_user), - doc_repo: DocumentRepository = Depends(get_repository(DocumentRepository)), - repository: CommentRepository = Depends(get_repository(CommentRepository)), -) -> CommentRead: - ... + comment: CommentCreate, + user: TokenData = Depends(get_current_user), + doc_repo: DocumentRepository = Depends(get_repository(DocumentRepository)), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> CommentRead: ... @router.get( @@ -36,12 +34,11 @@ async def create_comment( name="get_comments", ) async def get_document_comments( - doc_id: UUID, - user: TokenData = Depends(get_current_user), - doc_repo: DocumentRepository = Depends(get_repository(DocumentRepository)), - repository: CommentRepository = Depends(get_repository(CommentRepository)), -) -> List[CommentRead]: - ... + doc_id: UUID, + user: TokenData = Depends(get_current_user), + doc_repo: DocumentRepository = Depends(get_repository(DocumentRepository)), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> List[CommentRead]: ... @router.put( @@ -51,12 +48,11 @@ async def get_document_comments( name="update_comment", ) async def update_comment( - comment_id: UUID, - comment_update: CommentUpdate, - user: TokenData = Depends(get_current_user), - repository: CommentRepository = Depends(get_repository(CommentRepository)), -) -> CommentRead: - ... + comment_id: UUID, + comment_update: CommentUpdate, + user: TokenData = Depends(get_current_user), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> CommentRead: ... @router.delete( @@ -65,8 +61,7 @@ async def update_comment( name="delete_comment", ) async def delete_comment( - comment_id: UUID, - user: TokenData = Depends(get_current_user), - repository: CommentRepository = Depends(get_repository(CommentRepository)), -) -> None: - ... + comment_id: UUID, + user: TokenData = Depends(get_current_user), + repository: CommentRepository = Depends(get_repository(CommentRepository)), +) -> None: ... diff --git a/app/db/repositories/documents/comments.py b/app/db/repositories/documents/comments.py index 2c42a50..648866f 100644 --- a/app/db/repositories/documents/comments.py +++ b/app/db/repositories/documents/comments.py @@ -11,20 +11,18 @@ class CommentRepository: def __init__(self, session: AsyncSession): self.session = session - async def create(self, comment: CommentCreate, author_id: str) -> DocumentComment: - ... + async def create( + self, comment: CommentCreate, author_id: str + ) -> DocumentComment: ... - async def get(self, comment_id: UUID) -> Optional[DocumentComment]: - ... + async def get(self, comment_id: UUID) -> Optional[DocumentComment]: ... - async def get_document_comments(self, doc_id: UUID) -> List[DocumentComment]: - ... + async def get_document_comments(self, doc_id: UUID) -> List[DocumentComment]: ... - async def update(self, comment_id: UUID, comment_update: CommentUpdate) -> Optional[DocumentComment]: - ... + async def update( + self, comment_id: UUID, comment_update: CommentUpdate + ) -> Optional[DocumentComment]: ... - async def delete(self, comment_id: UUID) -> bool: - ... + async def delete(self, comment_id: UUID) -> bool: ... - async def user_can_modify(self, comment_id: UUID, user_id: str) -> bool: - ... + async def user_can_modify(self, comment_id: UUID, user_id: str) -> bool: ... diff --git a/app/db/tables/documents/documents_metadata.py b/app/db/tables/documents/documents_metadata.py index b20fa34..eab22ed 100644 --- a/app/db/tables/documents/documents_metadata.py +++ b/app/db/tables/documents/documents_metadata.py @@ -1,7 +1,7 @@ from datetime import datetime, timezone from uuid import uuid4 -from typing import List, Optional +from typing import List, Optional, Text from sqlalchemy import ( Column, String, @@ -61,30 +61,35 @@ class DocumentMetadata(Base): "User", secondary=doc_user_access, passive_deletes=True ) owner = relationship("User", back_populates="owner_of") - comments = relationship("DocumentComment", back_populates="document", cascade="all, delete-orphan") + comments = relationship( + "DocumentComment", back_populates="document", cascade="all, delete-orphan" + ) class DocumentComment(Base): __tablename__ = "document_comments" - id: UUID = Column(UUID(as_uuid=True), default=uuid4, primary_key=True, index=True, nullable=False) - doc_id: UUID = Column(UUID(as_uuid=True), ForeignKey("document_metadata.id", ondelete="CASCADE")) + id: UUID = Column( + UUID(as_uuid=True), default=uuid4, primary_key=True, index=True, nullable=False + ) + doc_id: UUID = Column( + UUID(as_uuid=True), ForeignKey("document_metadata.id", ondelete="CASCADE") + ) author_id: str = Column(String, ForeignKey("users.id"), nullable=False) comment: str = Column(Text, nullable=False) created_at = Column( DateTime(timezone=True), default=datetime.now(timezone.utc), nullable=False, - server_default=text("NOW()") + server_default=text("NOW()"), ) updated_at = Column( DateTime(timezone=True), default=datetime.now(timezone.utc), onupdate=datetime.now(timezone.utc), nullable=False, - server_default=text("NOW()") + server_default=text("NOW()"), ) document = relationship("DocumentMetadata", back_populates="comments") author = relationship("User", back_populates="comments") - diff --git a/app/schemas/documents/comments.py b/app/schemas/documents/comments.py index 82cebce..bf77b0d 100644 --- a/app/schemas/documents/comments.py +++ b/app/schemas/documents/comments.py @@ -8,8 +8,7 @@ class CommentCreate(CommentBase): doc_id: UUID -class CommentUpdate(CommentBase): - ... +class CommentUpdate(CommentBase): ... class CommentRead(CommentBase): diff --git a/migrations/versions/cb2ea87be0bd_document_comments.py b/migrations/versions/cb2ea87be0bd_document_comments.py index 61ba5d7..f117039 100644 --- a/migrations/versions/cb2ea87be0bd_document_comments.py +++ b/migrations/versions/cb2ea87be0bd_document_comments.py @@ -5,6 +5,7 @@ Create Date: 2024-12-15 01:24:30.954923 """ + from typing import Sequence, Union from alembic import op @@ -12,34 +13,52 @@ from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision: str = 'cb2ea87be0bd' -down_revision: Union[str, None] = '2a02384ab925' +revision: str = "cb2ea87be0bd" +down_revision: Union[str, None] = "2a02384ab925" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.create_table('document_comments', - sa.Column('id', sa.UUID(), nullable=False), - sa.Column('doc_id', sa.UUID(), nullable=True), - sa.Column('author_id', sa.String(), nullable=False), - sa.Column('comment', sa.Text(), nullable=False), - sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False), - sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False), - sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['doc_id'], ['document_metadata.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id') + op.create_table( + "document_comments", + sa.Column("id", sa.UUID(), nullable=False), + sa.Column("doc_id", sa.UUID(), nullable=True), + sa.Column("author_id", sa.String(), nullable=False), + sa.Column("comment", sa.Text(), nullable=False), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + server_default=sa.text("NOW()"), + nullable=False, + ), + sa.Column( + "updated_at", + sa.DateTime(timezone=True), + server_default=sa.text("NOW()"), + nullable=False, + ), + sa.ForeignKeyConstraint( + ["author_id"], + ["users.id"], + ), + sa.ForeignKeyConstraint( + ["doc_id"], ["document_metadata.id"], ondelete="CASCADE" + ), + sa.PrimaryKeyConstraint("id"), + ) + op.create_index( + op.f("ix_document_comments_id"), "document_comments", ["id"], unique=False ) - op.create_index(op.f('ix_document_comments_id'), 'document_comments', ['id'], unique=False) - op.drop_index('ix_notify_id', table_name='notify') - op.create_unique_constraint(None, 'share_url', ['url_id']) + op.drop_index("ix_notify_id", table_name="notify") + op.create_unique_constraint(None, "share_url", ["url_id"]) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint(None, 'share_url', type_='unique') - op.drop_index(op.f('ix_document_comments_id'), table_name='document_comments') - op.drop_table('document_comments') + op.drop_constraint(None, "share_url", type_="unique") + op.drop_index(op.f("ix_document_comments_id"), table_name="document_comments") + op.drop_table("document_comments") # ### end Alembic commands ### From 73979541a7f0901edd1a2c5c8f95c46f71ef09f2 Mon Sep 17 00:00:00 2001 From: jiisanda Date: Fri, 27 Dec 2024 23:31:55 +0530 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=97=A8=EF=B8=8F=20comment=20router?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/router.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/api/router.py b/app/api/router.py index 24e12b7..02166b6 100644 --- a/app/api/router.py +++ b/app/api/router.py @@ -1,6 +1,7 @@ from fastapi import APIRouter from app.api.routes.auth.auth import router as auth_router +from app.api.routes.documents.comments import router as document_comment from app.api.routes.documents.documents_metadata import ( router as documents_metadata_router, ) @@ -15,6 +16,7 @@ router.include_router(auth_router, prefix="/u") router.include_router(documents_router, prefix="") +router.include_router(document_comment, prefix="/comments") router.include_router(notify_router, prefix="/notifications") router.include_router(documents_metadata_router, prefix="/metadata") router.include_router(document_organization_router, prefix="/filter")