diff options
Diffstat (limited to 'api/dto/favourites.go')
| -rw-r--r-- | api/dto/favourites.go | 34 |
1 files changed, 34 insertions, 0 deletions
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"` +} |
