feat: enhance activity and task APIs with improved payload handling and response models

This commit is contained in:
Artem Kashaev
2025-11-27 16:43:46 +05:00
parent 0ecf1295d8
commit b8958dedbd
4 changed files with 119 additions and 42 deletions
+11 -4
View File
@@ -1,11 +1,18 @@
"""Pydantic schemas for activity endpoints."""
from __future__ import annotations
from typing import Any, Literal
from typing import Literal
from pydantic import BaseModel
from pydantic import BaseModel, Field
class ActivityCommentBody(BaseModel):
text: str = Field(..., min_length=1, max_length=2000)
class ActivityCommentPayload(BaseModel):
type: Literal["comment"]
payload: dict[str, Any]
type: Literal["comment"] = "comment"
payload: ActivityCommentBody
def extract_text(self) -> str:
return self.payload.text.strip()