22 lines
434 B
Go
22 lines
434 B
Go
package handlers
|
|
|
|
import (
|
|
"kontor-api-gin/internal/service"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type PermissionHandler struct {
|
|
Service *service.PermissionService
|
|
}
|
|
|
|
func (handler *PermissionHandler) List(c *gin.Context) {
|
|
permissions, err := handler.Service.List(c.Request.Context())
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, permissions)
|
|
}
|