MemberData split ID and profile, return on create.

This commit is contained in:
Miroslav Šedivý 2021-03-14 16:19:23 +01:00
parent 4d2fb157f9
commit fad3ab0062

View File

@ -10,7 +10,7 @@ import (
type MemberDataPayload struct { type MemberDataPayload struct {
ID string `json:"id"` ID string `json:"id"`
*types.MemberProfile Profile types.MemberProfile `json:"profile"`
} }
type MemberCreatePayload struct { type MemberCreatePayload struct {
@ -44,10 +44,9 @@ func (h *MembersHandler) membersList(w http.ResponseWriter, r *http.Request) {
members := []MemberDataPayload{} members := []MemberDataPayload{}
for id, profile := range entries { for id, profile := range entries {
profile := profile
members = append(members, MemberDataPayload{ members = append(members, MemberDataPayload{
ID: id, ID: id,
MemberProfile: &profile, Profile: profile,
}) })
} }
@ -89,6 +88,7 @@ func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
utils.HttpSuccess(w, MemberDataPayload{ utils.HttpSuccess(w, MemberDataPayload{
ID: id, ID: id,
Profile: data.Profile,
}) })
} }