Handler ListAllUsers in global_state.go added for GetAllUserApplication in db.go
This commit is contained in:
parent
aa7c5de1fc
commit
34ad6ac777
1 changed files with 12 additions and 0 deletions
|
@ -33,6 +33,7 @@ type GlobalState interface {
|
||||||
// SignCollection(c *fiber.Ctx) error // To sign a collection
|
// SignCollection(c *fiber.Ctx) error // To sign a collection
|
||||||
GetButtonCount(c *fiber.Ctx) error // For demonstration purposes
|
GetButtonCount(c *fiber.Ctx) error // For demonstration purposes
|
||||||
IncrementButtonCount(c *fiber.Ctx) error // For demonstration purposes
|
IncrementButtonCount(c *fiber.Ctx) error // For demonstration purposes
|
||||||
|
ListAllUsers(c *fiber.Ctx) error // To get a list of all users in the application database
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Constructor"
|
// "Constructor"
|
||||||
|
@ -180,3 +181,14 @@ func (gs *GState) GetUserProjects(c *fiber.Ctx) error {
|
||||||
// Return a json serialized list of projects
|
// Return a json serialized list of projects
|
||||||
return c.JSON(projects)
|
return c.JSON(projects)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gs *GState) ListAllUsers(c *fiber.Ctx) error {
|
||||||
|
// Get all users from the database
|
||||||
|
users, err := gs.Db.GetAllUsersApplication()
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(500).SendString(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the list of users as JSON
|
||||||
|
return c.JSON(users)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue