aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_rooms.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/api_rooms.go')
-rw-r--r--internal/admin/api_rooms.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/admin/api_rooms.go b/internal/admin/api_rooms.go
index b7f7d0e..448503d 100644
--- a/internal/admin/api_rooms.go
+++ b/internal/admin/api_rooms.go
@@ -138,7 +138,9 @@ func (s *AdminServer) handleRooms(w http.ResponseWriter, r *http.Request) {
func (s *AdminServer) handleRoomByID(w http.ResponseWriter, r *http.Request) {
idStr := strings.TrimPrefix(r.URL.Path, "/api/rooms/")
+ sub := ""
if idx := strings.IndexByte(idStr, '/'); idx >= 0 {
+ sub = idStr[idx+1:]
idStr = idStr[:idx]
}
id, err := strconv.Atoi(idStr)
@@ -147,6 +149,18 @@ func (s *AdminServer) handleRoomByID(w http.ResponseWriter, r *http.Request) {
return
}
+ switch sub {
+ case "course":
+ s.handleRoomCourse(w, r, id)
+ return
+ case "courses/attach":
+ s.handleRoomAttachCourse(w, r, id)
+ return
+ case "courses/detach":
+ s.handleRoomDetachCourse(w, r, id)
+ return
+ }
+
switch r.Method {
case http.MethodGet:
path, ok := s.world.GetRoomPath(id)