diff options
Diffstat (limited to 'server/guests')
-rw-r--r-- | server/guests/models.go | 17 | ||||
-rw-r--r-- | server/guests/store.go | 26 |
2 files changed, 43 insertions, 0 deletions
diff --git a/server/guests/models.go b/server/guests/models.go new file mode 100644 index 0000000..c68a4c3 --- /dev/null +++ b/server/guests/models.go @@ -0,0 +1,17 @@ +package guests + +type Guest struct { + Id int `json:"id"` + FirstName string `json:"firstName"` + LastName string `json:"lastName"` + Attendance string `json:"attendance"` + Email string `json:"email"` + Message string `json:"message"` + PartySize int `json:"partySize"` + PartyList []PartyGuest `json:"partyList"` +} + +type PartyGuest struct { + FirstName string `json:"firstName"` + LastName string `json:"lastName"` +} diff --git a/server/guests/store.go b/server/guests/store.go new file mode 100644 index 0000000..f1d8558 --- /dev/null +++ b/server/guests/store.go @@ -0,0 +1,26 @@ +package guests + +type MemStore struct { + guestMap map[int]Guest +} + +func NewMemStore() *MemStore { + guestMap := make(map[int]Guest) + return &MemStore{ + guestMap, + } +} + +func (m MemStore) Get() (map[int]Guest, error) { + return m.guestMap, nil +} + +func (m MemStore) Add(id int, guest Guest) error { + m.guestMap[id] = guest + return nil +} + +func (m MemStore) Update(id int, guest Guest) error { + m.guestMap[id] = guest + return nil +} |