fix(comments): address code review feedback
- Add onupdate=sa.func.now() to migration updated_at columns - Use UserProfile.is_blocked.is_(False) instead of == False - Fix British to American spelling (organised → organized) Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/3894af37-0f19-457b-8811-f1feb18b17ef
This commit is contained in:
+2
-7
@@ -138,7 +138,7 @@ def _build_thread_tree(comments: list[DocumentComment]) -> list[dict[str, Any]]:
|
|||||||
@router.get("/files/{file_id}/comments")
|
@router.get("/files/{file_id}/comments")
|
||||||
@require_login
|
@require_login
|
||||||
def list_comments(request: Request, file_id: int, db: DbSession):
|
def list_comments(request: Request, file_id: int, db: DbSession):
|
||||||
"""List all comments for a document, organised into threads.
|
"""List all comments for a document, organized into threads.
|
||||||
|
|
||||||
Returns a threaded tree where top-level comments contain nested
|
Returns a threaded tree where top-level comments contain nested
|
||||||
``replies``.
|
``replies``.
|
||||||
@@ -663,12 +663,7 @@ def list_mentionable_users(request: Request, db: DbSession):
|
|||||||
Returns:
|
Returns:
|
||||||
A list of ``{user_id, display_name}`` objects.
|
A list of ``{user_id, display_name}`` objects.
|
||||||
"""
|
"""
|
||||||
profiles = (
|
profiles = db.query(UserProfile).filter(UserProfile.is_blocked.is_(False)).order_by(UserProfile.display_name).all()
|
||||||
db.query(UserProfile)
|
|
||||||
.filter(UserProfile.is_blocked == False) # noqa: E712
|
|
||||||
.order_by(UserProfile.display_name)
|
|
||||||
.all()
|
|
||||||
)
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -2920,7 +2920,7 @@ Threaded comments and PDF annotations for document collaboration.
|
|||||||
|
|
||||||
**GET** `/api/files/{file_id}/comments`
|
**GET** `/api/files/{file_id}/comments`
|
||||||
|
|
||||||
Returns all comments for a document, organised into a threaded tree.
|
Returns all comments for a document, organized into a threaded tree.
|
||||||
|
|
||||||
**Response (200):**
|
**Response (200):**
|
||||||
```json
|
```json
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ def upgrade() -> None:
|
|||||||
sa.Column("mentions", sa.Text(), nullable=True),
|
sa.Column("mentions", sa.Text(), nullable=True),
|
||||||
sa.Column("is_resolved", sa.Boolean(), nullable=False, server_default="0"),
|
sa.Column("is_resolved", sa.Boolean(), nullable=False, server_default="0"),
|
||||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now()),
|
||||||
sa.ForeignKeyConstraint(["file_id"], ["files.id"]),
|
sa.ForeignKeyConstraint(["file_id"], ["files.id"]),
|
||||||
sa.ForeignKeyConstraint(["parent_id"], ["document_comments.id"]),
|
sa.ForeignKeyConstraint(["parent_id"], ["document_comments.id"]),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
@@ -59,7 +59,7 @@ def upgrade() -> None:
|
|||||||
sa.Column("annotation_type", sa.String(50), nullable=False, server_default="note"),
|
sa.Column("annotation_type", sa.String(50), nullable=False, server_default="note"),
|
||||||
sa.Column("color", sa.String(20), nullable=True),
|
sa.Column("color", sa.String(20), nullable=True),
|
||||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now()),
|
||||||
sa.ForeignKeyConstraint(["file_id"], ["files.id"]),
|
sa.ForeignKeyConstraint(["file_id"], ["files.id"]),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user