blob: ecc23dcf009e93279934e70a9b189ce2523f7100 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package controllers
import (
"shrine/services"
"shrine/utils/meta"
"shrine/utils/shortcuts"
"github.com/gofiber/fiber/v2"
)
func ListAuditLogsController(context *fiber.Ctx) error {
pagination := meta.Paginate(context)
action, _ := meta.Request(context).Query("action")
targetType, _ := meta.Request(context).Query("target_type")
items, total := services.ListAuditLogs(pagination, action, targetType)
return shortcuts.Success(context, pagination.Response(items, total))
}
func GetAuditLogController(context *fiber.Ctx) error {
ref := meta.Request(context).MustHave().Param("ref")
result, serviceErr := services.GetAuditLog(ref)
if serviceErr != nil {
return shortcuts.HandleError(context, serviceErr)
}
return shortcuts.Success(context, result)
}
|