From c00b690bd6f600554a1404e692bd9e4373325d27 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Fri, 17 Jan 2025 13:21:24 +0000 Subject: Initial commit --- api/dto/favourites.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 api/dto/favourites.go (limited to 'api/dto/favourites.go') diff --git a/api/dto/favourites.go b/api/dto/favourites.go new file mode 100644 index 0000000..0f8021f --- /dev/null +++ b/api/dto/favourites.go @@ -0,0 +1,34 @@ +package dto + +import "github.com/LMBishop/confplanner/pkg/database/sqlc" + +type CreateFavouritesRequest struct { + GUID *string `json:"eventGuid"` + ID *int32 `json:"eventId"` +} + +type CreateFavouritesResponse struct { + ID int32 `json:"id"` +} + +type GetFavouritesResponse struct { + ID int32 `json:"id"` + GUID *string `json:"eventGuid,omitempty"` + EventID *int32 `json:"eventId,omitempty"` +} + +func (dst *GetFavouritesResponse) Scan(src sqlc.Favourite) { + dst.ID = src.ID + if src.EventGuid.Valid { + strGuid := src.EventGuid.String() + dst.GUID = &strGuid + } + if src.EventID.Valid { + dst.EventID = &src.EventID.Int32 + } +} + +type DeleteFavouritesRequest struct { + GUID *string `json:"eventGuid"` + ID *int32 `json:"eventId"` +} -- cgit v1.2.3-70-g09d2