From fad3ab0062bafbdfb6ab53f0ab479962b80f825c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 14 Mar 2021 16:19:23 +0100 Subject: [PATCH] MemberData split ID and profile, return on create. --- internal/api/members/controler.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/api/members/controler.go b/internal/api/members/controler.go index 3a52c7f7..3ed94df7 100644 --- a/internal/api/members/controler.go +++ b/internal/api/members/controler.go @@ -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, }) }