Make notification data column a string

This commit is contained in:
Peter Vacho 2024-12-29 15:00:50 +01:00
parent dc18c86057
commit 8000087896
Signed by: school
GPG key ID: 8CFC3837052871B4

View file

@ -1,5 +1,5 @@
from datetime import UTC, datetime from datetime import UTC, datetime
from typing import Annotated, Any, ClassVar, Literal, final from typing import Annotated, ClassVar, Literal, final
from beanie import Document, Indexed from beanie import Document, Indexed
from pydantic import Field from pydantic import Field
@ -15,7 +15,7 @@ class Notification(Document):
user: Annotated[BeanieLink[User], Indexed()] user: Annotated[BeanieLink[User], Indexed()]
event_type: Annotated[Literal["reminder", "invitation"], Indexed()] event_type: Annotated[Literal["reminder", "invitation"], Indexed()]
message: str message: str
data: Any data: str
read: bool read: bool
created_at: datetime = Field(default_factory=lambda: datetime.now(UTC)) created_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
read_at: datetime | None = None read_at: datetime | None = None