62 lines
1.4 KiB
Go
62 lines
1.4 KiB
Go
package robots
|
|
|
|
import (
|
|
"jannex/robot-control-manager/modules/cache"
|
|
|
|
"git.ex.umbach.dev/Alex/roese-utils/rspagination"
|
|
"git.ex.umbach.dev/Alex/roese-utils/rsutils"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func GetRobots(c *fiber.Ctx) error {
|
|
// swagger:operation GET /api/v1/robots robots getRobots
|
|
// ---
|
|
// summary: Get all robots
|
|
// consumes:
|
|
// - application/json
|
|
// produces:
|
|
// - application/json
|
|
// parameters:
|
|
// - name: page
|
|
// in: query
|
|
// description: Page number
|
|
// responses:
|
|
// "200":
|
|
// schema:
|
|
// "$ref": "#/definitions/RobotsResponse"
|
|
|
|
var query rspagination.PageQuery
|
|
|
|
if err := rsutils.QueryParserHelper(c, &query); err != nil {
|
|
return c.SendStatus(fiber.StatusBadRequest)
|
|
}
|
|
|
|
return c.JSON(cache.GetAllRobots(query))
|
|
}
|
|
|
|
func GetUnauthorizedRobots(c *fiber.Ctx) error {
|
|
// swagger:operation GET /api/v1/urobots robots getUnauthorizedRobots
|
|
// ---
|
|
// summary: Get all unauthorized robots
|
|
// consumes:
|
|
// - application/json
|
|
// produces:
|
|
// - application/json
|
|
// parameters:
|
|
// - name: page
|
|
// in: query
|
|
// description: Page number
|
|
// responses:
|
|
// "200":
|
|
// schema:
|
|
// "$ref": "#/definitions/UnauthorizedRobotsResponse"
|
|
|
|
var query rspagination.PageQuery
|
|
|
|
if err := rsutils.QueryParserHelper(c, &query); err != nil {
|
|
return c.SendStatus(fiber.StatusBadRequest)
|
|
}
|
|
|
|
return c.JSON(cache.GetAllUnauthorizedRobots(query))
|
|
}
|