6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
142 lines
3.4 KiB
Python
142 lines
3.4 KiB
Python
"""
|
|
Pydantic schemas for chat comments and mentions.
|
|
"""
|
|
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
# =============================================================================
|
|
# Request Schemas
|
|
# =============================================================================
|
|
|
|
|
|
class CommentCreateRequest(BaseModel):
|
|
"""Schema for creating a comment or reply."""
|
|
|
|
content: str = Field(..., min_length=1, max_length=5000)
|
|
|
|
|
|
class CommentUpdateRequest(BaseModel):
|
|
"""Schema for updating a comment."""
|
|
|
|
content: str = Field(..., min_length=1, max_length=5000)
|
|
|
|
|
|
# =============================================================================
|
|
# Author Schema
|
|
# =============================================================================
|
|
|
|
|
|
class AuthorResponse(BaseModel):
|
|
"""Author information for comments."""
|
|
|
|
id: UUID
|
|
display_name: str | None = None
|
|
avatar_url: str | None = None
|
|
email: str
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
# =============================================================================
|
|
# Comment Schemas
|
|
# =============================================================================
|
|
|
|
|
|
class CommentReplyResponse(BaseModel):
|
|
"""Schema for a comment reply (no nested replies)."""
|
|
|
|
id: int
|
|
content: str
|
|
content_rendered: str
|
|
author: AuthorResponse | None = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
is_edited: bool
|
|
can_edit: bool = False
|
|
can_delete: bool = False
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class CommentResponse(BaseModel):
|
|
"""Schema for a top-level comment with replies."""
|
|
|
|
id: int
|
|
message_id: int
|
|
content: str
|
|
content_rendered: str
|
|
author: AuthorResponse | None = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
is_edited: bool
|
|
can_edit: bool = False
|
|
can_delete: bool = False
|
|
reply_count: int
|
|
replies: list[CommentReplyResponse] = []
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class CommentListResponse(BaseModel):
|
|
"""Response for listing comments on a message."""
|
|
|
|
comments: list[CommentResponse]
|
|
total_count: int
|
|
|
|
|
|
class CommentBatchRequest(BaseModel):
|
|
"""Request for batch-fetching comments for multiple messages."""
|
|
|
|
message_ids: list[int] = Field(..., min_length=1, max_length=200)
|
|
|
|
|
|
class CommentBatchResponse(BaseModel):
|
|
"""Batch response keyed by message_id."""
|
|
|
|
comments_by_message: dict[int, CommentListResponse]
|
|
|
|
|
|
# =============================================================================
|
|
# Mention Schemas
|
|
# =============================================================================
|
|
|
|
|
|
class MentionContextResponse(BaseModel):
|
|
"""Context information for where a mention occurred."""
|
|
|
|
thread_id: int
|
|
thread_title: str
|
|
message_id: int
|
|
workspace_id: int
|
|
workspace_name: str
|
|
|
|
|
|
class MentionCommentResponse(BaseModel):
|
|
"""Abbreviated comment info for mention display."""
|
|
|
|
id: int
|
|
content_preview: str
|
|
author: AuthorResponse | None = None
|
|
created_at: datetime
|
|
|
|
|
|
class MentionResponse(BaseModel):
|
|
"""Schema for a mention notification."""
|
|
|
|
id: int
|
|
created_at: datetime
|
|
comment: MentionCommentResponse
|
|
context: MentionContextResponse
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class MentionListResponse(BaseModel):
|
|
"""Response for listing user's mentions."""
|
|
|
|
mentions: list[MentionResponse]
|
|
total_count: int
|