♻️ Refactored event audit system

This commit is contained in:
2025-03-15 16:37:47 +08:00
parent 35e5eadb05
commit 32e91e2601
15 changed files with 113 additions and 69 deletions

View File

@ -36,7 +36,10 @@ func updateAuthPreference(c *fiber.Ctx) error {
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else {
services.AddEvent(user.ID, "preferences.edit", "auth", c.IP(), c.Get(fiber.HeaderUserAgent))
services.AddEvent(user.ID, "preferences.edit", map[string]any{
"type": "auth",
"preferences": data,
}, c.IP(), c.Get(fiber.HeaderUserAgent))
}
return c.JSON(cfg.Config.Data())
@ -73,7 +76,10 @@ func updateNotificationPreference(c *fiber.Ctx) error {
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else {
services.AddEvent(user.ID, "preferences.edit", "notifications", c.IP(), c.Get(fiber.HeaderUserAgent))
services.AddEvent(user.ID, "preferences.edit", map[string]any{
"type": "notify",
"preferences": data,
}, c.IP(), c.Get(fiber.HeaderUserAgent))
}
return c.JSON(notification)