19 lines
441 B
Python
19 lines
441 B
Python
"""Pydantic schemas for activity endpoints."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ActivityCommentBody(BaseModel):
|
|
text: str = Field(..., min_length=1, max_length=2000)
|
|
|
|
|
|
class ActivityCommentPayload(BaseModel):
|
|
type: Literal["comment"] = "comment"
|
|
payload: ActivityCommentBody
|
|
|
|
def extract_text(self) -> str:
|
|
return self.payload.text.strip()
|