bug fix
parent
7983421371
commit
984c185a9c
|
|
@ -40,15 +40,13 @@ func GetCorporation(c *fiber.Ctx) error {
|
||||||
|
|
||||||
u := c.Locals("user").(models.User)
|
u := c.Locals("user").(models.User)
|
||||||
|
|
||||||
id := c.Params("id")
|
|
||||||
|
|
||||||
if u.UserType != "A" {
|
if u.UserType != "A" {
|
||||||
return fiber.NewError(fiber.StatusUnauthorized, "Unauthorized: User is not admin")
|
return fiber.NewError(fiber.StatusUnauthorized, "Unauthorized: User is not admin")
|
||||||
}
|
}
|
||||||
|
|
||||||
var corp models.Corporation
|
var corps []models.Corporation
|
||||||
|
|
||||||
database.DB.Find(&corp, "id = ?", id)
|
database.DB.Find(&corps)
|
||||||
|
|
||||||
return c.JSON(corp)
|
return c.JSON(corps)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ func Setup(app *fiber.App) {
|
||||||
app.Post("/on_pub_stop", controllers.OnPubStop)
|
app.Post("/on_pub_stop", controllers.OnPubStop)
|
||||||
app.Post("/on_sub_start", controllers.OnSubStart)
|
app.Post("/on_sub_start", controllers.OnSubStart)
|
||||||
|
|
||||||
app.Get("/corporations/:id", controllers.GetCorporation)
|
app.Get("/corporations", controllers.GetCorporation)
|
||||||
|
|
||||||
// Protected routes. Needs login before.
|
// Protected routes. Needs login before.
|
||||||
protected := app.Group("/")
|
protected := app.Group("/")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue