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
This commit is contained in:
20
controllers/user.go
Normal file
20
controllers/user.go
Normal file
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user