aboutsummaryrefslogtreecommitdiffstats
path: root/api/dto/favourites.go
blob: 0f8021f0b2ff4430829dea436993851eb1cdfd52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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"`
}