package dbhandling
import (
+ "encoding/json"
"net/http"
)
roomList = append(roomList, k)
}
}
+
+ b, err := json.Marshal(roomList)
+ if err != nil {
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ w.Write(b)
+ w.WriteHeader(http.StatusOK)
}
/** TODO TEST
- *
+ * Get the id's of the songs present in a room using the name of the room
+ * the sent JSON should just be a string with the name of the room
**/
func (dbw *DBWrapper) RoomsGetByName(w http.ResponseWriter, r *http.Request) {
}
/** TODO TEST
- *
+ * Create a new room with the given name
+ * Just a string value as the name
+ * May be rejected if a room with that name already exists
**/
func (dbw *DBWrapper) RoomsCreate(w http.ResponseWriter, r *http.Request) {
}
/** TODO TEST
- *
+ * Add songs to a room using the ID of the song and the NAME of the room
+ * The values should be given in the following way:
+ * {
+ * roomName: "NAME OF ROOM",
+ * songIds: [1, 2, 3, 4, 5],
+ * }
**/
func (dbw *DBWrapper) RoomsAddByNameAndId(w http.ResponseWriter, r *http.Request) {
}
/** TODO TEST
- *
+ * The same as adding, except that the IDs mentioned in the list will be removed from the room
+ * (if they are present)
**/
func (dbw *DBWrapper) RoomsRemoveByNameAndId(w http.ResponseWriter, r *http.Request) {
}
/** TODO TEST
- *
+ * Delete a room by giving the name as a string, this just means the room won't exist anymore
**/
func (dbw *DBWrapper) RoomsDeleteByName(w http.ResponseWriter, r *http.Request) {
}