more frontend formatting and logic for locations and rooms
This commit is contained in:
12
handlers.go
12
handlers.go
@@ -231,6 +231,18 @@ func (s *Server) AddNewRoomHandler(c *fiber.Ctx) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Update our location in the db to add the new room as attached to the ID
|
||||
loc, err = s.GetLocation(newRoom.LocationID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
roomList := loc.Rooms
|
||||
roomList = append(roomList, newRoom)
|
||||
|
||||
err = s.Database.UpdateField(&Location{ID: newRoom.LocationID}, "Rooms", roomList)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.Log.Debug().Msgf("Adding new Room: %v", newRoom)
|
||||
return c.Status(fiber.StatusOK).SendString(fmt.Sprintf("New Room Created! %s", newRoom.Name))
|
||||
}
|
||||
|
Reference in New Issue
Block a user