Compare commits

...

3 commits

3 changed files with 6 additions and 6 deletions

View file

@ -152,8 +152,8 @@ async def get_user_invitatinos(user_id: PydanticObjectId, user: CurrentUserDep)
return [InvitationData.from_invitation(invitation) for invitation in invitations] return [InvitationData.from_invitation(invitation) for invitation in invitations]
@base_router.get("/users/{user_id}/invitations/incomming") @base_router.get("/users/{user_id}/invitations/incoming")
async def get_user_incomming_invitatinos(user_id: PydanticObjectId, user: CurrentUserDep) -> list[InvitationData]: async def get_user_incoming_invitatinos(user_id: PydanticObjectId, user: CurrentUserDep) -> list[InvitationData]:
"""Get all incoming invitations for a given user. """Get all incoming invitations for a given user.
Note that this endpoint only allows you to access the invitations you received. Note that this endpoint only allows you to access the invitations you received.

View file

@ -1,5 +1,5 @@
from datetime import UTC, datetime from datetime import UTC, datetime
from typing import Any, Literal, cast, final from typing import Literal, cast, final
from beanie import Link, PydanticObjectId from beanie import Link, PydanticObjectId
from fastapi import APIRouter, HTTPException, status from fastapi import APIRouter, HTTPException, status
@ -26,9 +26,9 @@ class NotificationData(BaseModel):
id: PydanticObjectId id: PydanticObjectId
user_id: PydanticObjectId user_id: PydanticObjectId
event_type: Literal["reminder", "invitation"] event_type: Literal["message", "invitation"]
message: str message: str
data: Any data: str
read: bool read: bool
created_at: datetime created_at: datetime
read_at: datetime | None read_at: datetime | None

View file

@ -13,7 +13,7 @@ class Notification(Document):
"""Notification table.""" """Notification table."""
user: Annotated[BeanieLink[User], Indexed()] user: Annotated[BeanieLink[User], Indexed()]
event_type: Annotated[Literal["reminder", "invitation"], Indexed()] event_type: Annotated[Literal["message", "invitation"], Indexed()]
message: str message: str
data: str data: str
read: bool read: bool