more database work, added search route, starting frontend new location form

This commit is contained in:
2022-04-02 23:15:23 -04:00
parent cc60aa59d5
commit 03dd723c57
14 changed files with 431 additions and 1110 deletions

View File

@@ -19,6 +19,20 @@ func (s *Server) GetAllItemsHandler(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(items)
}
// GetItemHandler returns a single item from an ID
func (s *Server) GetItemHandler(c *fiber.Ctx) error {
itemID, err := c.ParamsInt("itemID")
if err != nil {
return err
}
room, err := s.GetItem(itemID)
if err != nil {
s.Log.Err(err).Msgf("Unable to fetch item with id: %d", itemID)
return err
}
return c.Status(fiber.StatusOK).JSON(room)
}
// GetAllItemsAtRoomHandler gets all items in a room
func (s *Server) GetAllItemsAtRoomHandler(c *fiber.Ctx) error {
roomID, err := c.ParamsInt("roomID")