package dbhandling
-import "net/http"
+import (
+ "net/http"
+)
-/** TODO
- *
+/** TEST
+ * Get all the names of all the rooms in the database
**/
func (dbw *DBWrapper) RoomsGet(w http.ResponseWriter, r *http.Request) {
+
+ allKeys, err := dbw.RedisDb.Keys(dbw.Ctx, "*").Result()
+ if err != nil {
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ roomList := make([]string, 0)
+
+ for _, k := range allKeys {
+ t, err := dbw.RedisDb.Type(dbw.Ctx, k).Result()
+ if err != nil {
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ if t == "zset" {
+ roomList = append(roomList, k)
+ }
+ }
+}
+
+/** TODO TEST
+ *
+ **/
+func (dbw *DBWrapper) RoomsGetByName(w http.ResponseWriter, r *http.Request) {
}
-/** TODO
+/** TODO TEST
*
**/
func (dbw *DBWrapper) RoomsCreate(w http.ResponseWriter, r *http.Request) {
}
-/** TODO
+/** TODO TEST
*
**/
func (dbw *DBWrapper) RoomsAddByNameAndId(w http.ResponseWriter, r *http.Request) {
}
-/** TODO
+/** TODO TEST
*
**/
func (dbw *DBWrapper) RoomsRemoveByNameAndId(w http.ResponseWriter, r *http.Request) {
}
-/** TODO
+/** TODO TEST
*
**/
func (dbw *DBWrapper) RoomsDeleteByName(w http.ResponseWriter, r *http.Request) {