Compare commits
2 Commits
7bd73b4ddc
...
192da1a74f
| Author | SHA1 | Date |
|---|---|---|
|
|
192da1a74f | |
|
|
0d0aeffef1 |
|
|
@ -1,6 +1,7 @@
|
|||
package routing
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"log"
|
||||
"net/http"
|
||||
"slices"
|
||||
|
|
@ -143,6 +144,11 @@ func GroupPost(app *lishwist.Session, session *response.Session, h http.Header,
|
|||
return response.Data("", group)
|
||||
}
|
||||
|
||||
type GroupList struct {
|
||||
XMLName xml.Name `xml:"Groups" json:"-"`
|
||||
Groups []lishwist.Group `xml:"Group"`
|
||||
}
|
||||
|
||||
func Groups(app *lishwist.Session, session *response.Session, h http.Header, r *http.Request) rsvp.Response {
|
||||
admin := app.Admin()
|
||||
if admin == nil {
|
||||
|
|
@ -154,5 +160,5 @@ func Groups(app *lishwist.Session, session *response.Session, h http.Header, r *
|
|||
return response.Error(http.StatusInternalServerError, "Failed to get groups: %s", err)
|
||||
}
|
||||
|
||||
return response.Data("", groups)
|
||||
return response.Data("", GroupList{Groups: groups})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package routing
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
lishwist "lishwist/core"
|
||||
"lishwist/http/response"
|
||||
"net/http"
|
||||
|
|
@ -8,6 +9,11 @@ import (
|
|||
"github.com/Teajey/rsvp"
|
||||
)
|
||||
|
||||
type UserList struct {
|
||||
XMLName xml.Name `xml:"Users" json:"-"`
|
||||
Users []lishwist.User `xml:"User"`
|
||||
}
|
||||
|
||||
func Users(app *lishwist.Session, session *response.Session, h http.Header, r *http.Request) rsvp.Response {
|
||||
admin := app.Admin()
|
||||
if admin == nil {
|
||||
|
|
@ -19,7 +25,7 @@ func Users(app *lishwist.Session, session *response.Session, h http.Header, r *h
|
|||
return response.Error(http.StatusInternalServerError, "Failed to get users: %s", err)
|
||||
}
|
||||
|
||||
return response.Data("", users)
|
||||
return response.Data("", UserList{Users: users})
|
||||
}
|
||||
|
||||
func User(app *lishwist.Session, session *response.Session, h http.Header, r *http.Request) rsvp.Response {
|
||||
|
|
|
|||
Loading…
Reference in New Issue