more database work, added search route, starting frontend new location form
This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user