feat: enhance activity and task APIs with improved payload handling and response models
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user