Files
Björn Benouarets e76469ad55 feat: add business logic controllers
- Add authentication controller for login, logout, and token refresh
- Add user controller for user management and profile operations
- Add session controller for session management and validation
- Add access controller for API access control and permissions
- Include proper input validation and error handling
- Implement secure authentication flows
2025-09-25 23:24:32 +02:00

21 lines
525 B
Go

package controllers
import (
"git.secnex.io/secnex/idp-api/api"
"git.secnex.io/secnex/idp-api/repositories"
"github.com/gofiber/fiber/v2"
"gorm.io/gorm"
)
func GetUsers(c *fiber.Ctx) error {
db := c.Locals("db").(*gorm.DB)
userRepo := repositories.NewUserRepository(db)
users, err := userRepo.GetAllUsers()
if err != nil {
return api.Error(c, "Failed to get users", fiber.StatusInternalServerError, fiber.Map{
"message": "Failed to get users",
})
}
return api.Success(c, users, fiber.StatusOK, nil, nil)
}