aboutsummaryrefslogtreecommitdiffstats
path: root/api/dto/favourites.go
blob: 44c68a2a65582e087a9d610f4a88580fb90fffd6 (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
35
36
package dto

import "github.com/LMBishop/confplanner/pkg/database/sqlc"

type CreateFavouritesRequest struct {
	ConferenceID int32   `json:"conferenceID" validate:"required"`
	GUID         *string `json:"eventGuid"`
	EventID      *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 {
	ConferenceID int32   `json:"conferenceID" validate:"required"`
	GUID         *string `json:"eventGuid"`
	EventID      *int32  `json:"eventId"`
}