mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
MemberDataPayload & membersList implemented.
This commit is contained in:
parent
7fb40c0384
commit
f1f26b5f25
@ -7,13 +7,13 @@ import (
|
|||||||
"demodesk/neko/internal/types"
|
"demodesk/neko/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MemberCreatePayload struct {
|
type MemberDataPayload struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
*types.MemberProfile
|
*types.MemberProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
|
func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
|
||||||
data := &MemberCreatePayload{
|
data := &MemberDataPayload{
|
||||||
// default values
|
// default values
|
||||||
MemberProfile: &types.MemberProfile{
|
MemberProfile: &types.MemberProfile{
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
@ -58,7 +58,7 @@ func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.HttpSuccess(w, MemberCreatePayload{
|
utils.HttpSuccess(w, MemberDataPayload{
|
||||||
ID: session.ID(),
|
ID: session.ID(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (h *MembersHandler) membersList(w http.ResponseWriter, r *http.Request) {
|
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)
|
utils.HttpSuccess(w, members)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user