join members endpoints to one file.

This commit is contained in:
Miroslav Šedivý 2020-12-08 16:05:54 +01:00
parent f1f26b5f25
commit 9786c8d537
2 changed files with 13 additions and 20 deletions

View File

@ -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

View File

@ -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)
}