Implement KeepUpdated. Switch to Logrus logger. Relocate score-related functions.

This commit is contained in:
MaxJa4
2024-01-22 16:03:18 +01:00
parent 7cdc18bd78
commit da1ff4e4e5
16 changed files with 348 additions and 280 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"log"
"net/http"
)
@@ -68,10 +67,7 @@ func AddClan(c *gin.Context) {
c.JSON(http.StatusOK, clan)
_, err := fmt.Fprintf(utils.GinWriter, "Added clan '"+clan.Name+"' with tag '"+clan.Tag+"'\n")
if err != nil {
log.Fatal(err)
}
utils.Logger.Infof("Added clan '%s' with tag '%s'", clan.Name, clan.Tag)
}
// GetClanByID GET /clan/:id
@@ -108,10 +104,7 @@ func UpdateClanByID(c *gin.Context) {
c.JSON(http.StatusOK, nil)
_, err := fmt.Fprintf(utils.GinWriter, "Updated clan '"+input.Name+"' with tag '"+input.Tag+"'\n")
if err != nil {
log.Fatal(err)
}
utils.Logger.Infof("Updated clan '%s' with tag '%s'", input.Name, input.Tag)
}
// DeleteClanByID DELETE /clan/:id
@@ -126,10 +119,7 @@ func DeleteClanByID(c *gin.Context) {
c.JSON(http.StatusOK, true)
_, err := fmt.Fprintf(utils.GinWriter, "Deleted clan '"+clan.Name+"' with tag '"+clan.Tag+"'\n")
if err != nil {
log.Fatal(err)
}
utils.Logger.Infof("Deleted clan '%s' with tag '%s'", clan.Name, clan.Tag)
}
// DeleteAllClans DELETE /admin/clan