Compare commits

...

2 Commits

Author SHA1 Message Date
Felipe Cardoso
cd22418786 Add event_id and guest_id fields to RSVPSchemaBase
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 47s
Build and Push Docker Images / build-frontend (push) Has been skipped
This update introduces event_id and guest_id fields to the RSVPSchemaBase model, ensuring better tracking of RSVP details. These additions enhance data association and model usability.
2025-03-19 08:38:22 +01:00
Felipe Cardoso
472a0b7834 Add delete functionality for gifts in the dashboard
Introduced `handleDeleteGift` to delete a gift and refetch items after deletion. Connected the delete action to the dropdown menu, enabling users to remove gifts from the UI seamlessly. This enhances gift management capabilities on the dashboard.
2025-03-19 08:23:26 +01:00
2 changed files with 12 additions and 1 deletions

View File

@@ -12,6 +12,8 @@ class RSVPStatus(str, Enum):
class RSVPSchemaBase(BaseModel):
event_id: UUID
guest_id: UUID
status: RSVPStatus = Field(...)
number_of_guests: int = Field(default=1, ge=1)
response_message: str | None = None

View File

@@ -62,6 +62,7 @@ export default function GiftRegistryPage() {
refetchItems,
currentEventId,
setCurrentEventId,
deleteItem,
} = useGifts();
// State for modals
@@ -188,6 +189,11 @@ export default function GiftRegistryPage() {
setIsAddGiftModalOpen(true);
};
const handleDeleteGift = async (id: string) => {
await deleteItem(id);
await refetchItems(undefined, event?.id);
};
const handleEditGift = (giftId: string) => {
setSelectedGiftId(giftId);
setIsEditGiftModalOpen(true);
@@ -412,7 +418,10 @@ export default function GiftRegistryPage() {
<Edit className="h-4 w-4 mr-2" /> Edit
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem className="text-red-600">
<DropdownMenuItem
className="text-red-600"
onClick={() => handleDeleteGift(item.id)}
>
<Trash className="h-4 w-4 mr-2" /> Delete
</DropdownMenuItem>
</DropdownMenuContent>