Fix some endpoint paths

This commit is contained in:
Peter Vacho 2024-12-31 01:30:01 +01:00
parent b0bbc7e81a
commit 0f820d12e3
Signed by: school
GPG key ID: 8CFC3837052871B4
4 changed files with 13 additions and 13 deletions

View file

@ -141,7 +141,7 @@ async def get_event_categories(event_id: PydanticObjectId, user: CurrentUserDep)
return [CategoryData.from_category(category) for category in cast(list[Category], event.categories)]
@categories_router.get("{category_id}")
@categories_router.get("/{category_id}")
async def get_category(category_id: PydanticObjectId, user: CurrentUserDep) -> CategoryData:
"""Get a category by ID."""
category = await Category.get(category_id, fetch_links=True)
@ -156,7 +156,7 @@ async def get_category(category_id: PydanticObjectId, user: CurrentUserDep) -> C
return CategoryData.from_category(category)
@categories_router.delete("{category_id}")
@categories_router.delete("/{category_id}")
async def delete_category(category_id: PydanticObjectId, user: CurrentUserDep) -> Response:
"""Delete the given category.
@ -196,7 +196,7 @@ async def create_category(
return CategoryData.from_category(category)
@categories_router.put("{category_id}")
@categories_router.put("/{category_id}")
async def overwrite_category(
category_id: PydanticObjectId,
user: CurrentUserDep,
@ -216,7 +216,7 @@ async def overwrite_category(
return CategoryData.from_category(category)
@categories_router.patch("{category_id}")
@categories_router.patch("/{category_id}")
async def update_category(
category_id: PydanticObjectId,
user: CurrentUserDep,

View file

@ -235,7 +235,7 @@ async def get_user_invited_events(
return [EventData.from_event(event) for event in events]
@events_router.get("{event_id}")
@events_router.get("/{event_id}")
async def get_event(event_id: PydanticObjectId, user: CurrentUserDep) -> EventData:
"""Get an event by ID.
@ -260,7 +260,7 @@ async def get_event(event_id: PydanticObjectId, user: CurrentUserDep) -> EventDa
return EventData.from_event(event)
@events_router.delete("{event_id}")
@events_router.delete("/{event_id}")
async def delete_event(event_id: PydanticObjectId, user: CurrentUserDep) -> Response:
"""Delete an event by ID."""
event = await Event.get(event_id)
@ -287,7 +287,7 @@ async def create_event(
return EventData.from_event(event)
@events_router.put("{event_id}")
@events_router.put("/{event_id}")
async def overwrite_event(
event_id: PydanticObjectId,
user: CurrentUserDep,

View file

@ -174,7 +174,7 @@ async def get_user_incomming_invitatinos(user_id: PydanticObjectId, user: Curren
return [InvitationData.from_invitation(invitation) for invitation in invitations]
@invitations_router.get("{invitation_id}")
@invitations_router.get("/{invitation_id}")
async def get_invitation(invitation_id: PydanticObjectId, user: CurrentUserDep) -> InvitationData:
"""Get information about a specific invitation.
@ -201,7 +201,7 @@ async def create_invitation(data: InvitationCreateData, user: CurrentUserDep) ->
return InvitationData.from_invitation(invitation)
@invitations_router.delete("{invitation_id}")
@invitations_router.delete("/{invitation_id}")
async def delete_invitation(invitation_id: PydanticObjectId, user: CurrentUserDep) -> Response:
"""Delete an invitation."""
invitation = await Invitation.get(invitation_id, fetch_links=True)
@ -219,7 +219,7 @@ async def delete_invitation(invitation_id: PydanticObjectId, user: CurrentUserDe
return Response(status.HTTP_204_NO_CONTENT)
@invitations_router.post("{invitation_id}/accept")
@invitations_router.post("/{invitation_id}/accept")
async def accept_invitation(invitation_id: PydanticObjectId, user: CurrentUserDep) -> Response:
"""Accept an invitation."""
invitation = await Invitation.get(invitation_id, fetch_links=True)
@ -261,7 +261,7 @@ async def accept_invitation(invitation_id: PydanticObjectId, user: CurrentUserDe
return Response(status_code=status.HTTP_204_NO_CONTENT)
@invitations_router.post("{invitation_id}/decline")
@invitations_router.post("/{invitation_id}/decline")
async def decline_invitation(invitation_id: PydanticObjectId, user: CurrentUserDep) -> Response:
"""Decline an invitation."""
invitation = await Invitation.get(invitation_id, fetch_links=True)

View file

@ -72,7 +72,7 @@ async def get_user_notifications(user_id: PydanticObjectId, user: CurrentUserDep
return [NotificationData.from_notification(notification) for notification in notifications]
@notifications_router.get("{notification_id}")
@notifications_router.get("/{notification_id}")
async def get_notification(notification_id: PydanticObjectId, user: CurrentUserDep) -> NotificationData:
"""Get a single notification."""
notification = await Notification.get(notification_id, fetch_links=True)
@ -89,7 +89,7 @@ async def get_notification(notification_id: PydanticObjectId, user: CurrentUserD
return NotificationData.from_notification(notification)
@notifications_router.get("{notification_id}/read")
@notifications_router.get("/{notification_id}/read")
async def read_notification(notification_id: PydanticObjectId, user: CurrentUserDep) -> NotificationData:
"""Mark a notification as read."""
notification = await Notification.get(notification_id, fetch_links=True)