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

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