From 9786c8d537d7722af8edf67c7adc93b966611a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Tue, 8 Dec 2020 16:05:54 +0100 Subject: [PATCH] join members endpoints to one file. --- .../api/members/{crud.go => controler.go} | 13 ++++++++++++ internal/api/members/list.go | 20 ------------------- 2 files changed, 13 insertions(+), 20 deletions(-) rename internal/api/members/{crud.go => controler.go} (84%) delete mode 100644 internal/api/members/list.go diff --git a/internal/api/members/crud.go b/internal/api/members/controler.go similarity index 84% rename from internal/api/members/crud.go rename to internal/api/members/controler.go index 40e735c1..e35d326e 100644 --- a/internal/api/members/crud.go +++ b/internal/api/members/controler.go @@ -12,6 +12,19 @@ type MemberDataPayload struct { *types.MemberProfile } +func (h *MembersHandler) membersList(w http.ResponseWriter, r *http.Request) { + members := []MemberDataPayload{} + for _, session := range h.sessions.Members() { + profile := session.GetProfile() + members = append(members, MemberDataPayload{ + ID: session.ID(), + MemberProfile: &profile, + }) + } + + utils.HttpSuccess(w, members) +} + func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) { data := &MemberDataPayload{ // default values diff --git a/internal/api/members/list.go b/internal/api/members/list.go deleted file mode 100644 index 48862440..00000000 --- a/internal/api/members/list.go +++ /dev/null @@ -1,20 +0,0 @@ -package members - -import ( - "net/http" - - "demodesk/neko/internal/utils" -) - -func (h *MembersHandler) membersList(w http.ResponseWriter, r *http.Request) { - members := []MemberDataPayload{} - for _, session := range h.sessions.Members() { - profile := session.GetProfile() - members = append(members, MemberDataPayload{ - ID: session.ID(), - MemberProfile: &profile, - }) - } - - utils.HttpSuccess(w, members) -}