All checks were successful
continuous-integration/drone/push Build is passing
24 lines
461 B
Go
24 lines
461 B
Go
package controllers
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
"smt/models"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func GetAuditLogsHandler(c *gin.Context) {
|
|
logs, err := models.AuditLogList()
|
|
|
|
if err != nil {
|
|
errString := fmt.Sprintf("error retrieving audit logs : '%s'", err)
|
|
log.Printf("GetAuditLogsHandler %s\n", errString)
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, gin.H{"message": "success", "data": logs})
|
|
}
|