aboutsummaryrefslogtreecommitdiff
path: root/backend/handlers/mod.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-09-27 22:52:19 +0300
committerGitHub <noreply@github.com>2023-09-27 22:52:19 +0300
commit1ef4498dadd8cdf7b60f4f256697d9329c9e9deb (patch)
treed70a1dd5bfff99a4add4aaa47bc584b3c2305131 /backend/handlers/mod.go
parentfeat: detailed logging, db changes (#55) (diff)
downloadlphub-1ef4498dadd8cdf7b60f4f256697d9329c9e9deb.tar.gz
lphub-1ef4498dadd8cdf7b60f4f256697d9329c9e9deb.tar.bz2
lphub-1ef4498dadd8cdf7b60f4f256697d9329c9e9deb.zip
feat: revise logging in other handlers (#55)
Former-commit-id: ef5d934328d4389405cd51c08c2738093353a5cd
Diffstat (limited to 'backend/handlers/mod.go')
-rw-r--r--backend/handlers/mod.go9
1 files changed, 0 insertions, 9 deletions
diff --git a/backend/handlers/mod.go b/backend/handlers/mod.go
index b8b6f9f..95b37c8 100644
--- a/backend/handlers/mod.go
+++ b/backend/handlers/mod.go
@@ -62,7 +62,6 @@ func CreateMapSummary(c *gin.Context) {
62 id := c.Param("mapid") 62 id := c.Param("mapid")
63 mapID, err := strconv.Atoi(id) 63 mapID, err := strconv.Atoi(id)
64 if err != nil { 64 if err != nil {
65 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryCreateFail, "ATOI: "+err.Error())
66 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 65 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
67 return 66 return
68 } 67 }
@@ -75,7 +74,6 @@ func CreateMapSummary(c *gin.Context) {
75 // Start database transaction 74 // Start database transaction
76 tx, err := database.DB.Begin() 75 tx, err := database.DB.Begin()
77 if err != nil { 76 if err != nil {
78 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryCreateFail, "TX#B: "+err.Error())
79 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 77 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
80 return 78 return
81 } 79 }
@@ -111,7 +109,6 @@ func CreateMapSummary(c *gin.Context) {
111 return 109 return
112 } 110 }
113 if err = tx.Commit(); err != nil { 111 if err = tx.Commit(); err != nil {
114 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryCreateFail, "TX#C: "+err.Error())
115 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 112 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
116 return 113 return
117 } 114 }
@@ -149,7 +146,6 @@ func EditMapSummary(c *gin.Context) {
149 id := c.Param("mapid") 146 id := c.Param("mapid")
150 mapID, err := strconv.Atoi(id) 147 mapID, err := strconv.Atoi(id)
151 if err != nil { 148 if err != nil {
152 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryEditFail, "ATOI: "+err.Error())
153 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 149 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
154 return 150 return
155 } 151 }
@@ -162,7 +158,6 @@ func EditMapSummary(c *gin.Context) {
162 // Start database transaction 158 // Start database transaction
163 tx, err := database.DB.Begin() 159 tx, err := database.DB.Begin()
164 if err != nil { 160 if err != nil {
165 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryEditFail, "TX#B: "+err.Error())
166 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 161 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
167 return 162 return
168 } 163 }
@@ -199,7 +194,6 @@ func EditMapSummary(c *gin.Context) {
199 return 194 return
200 } 195 }
201 if err = tx.Commit(); err != nil { 196 if err = tx.Commit(); err != nil {
202 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryEditFail, "TX#C: "+err.Error())
203 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 197 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
204 return 198 return
205 } 199 }
@@ -237,7 +231,6 @@ func DeleteMapSummary(c *gin.Context) {
237 id := c.Param("mapid") 231 id := c.Param("mapid")
238 mapID, err := strconv.Atoi(id) 232 mapID, err := strconv.Atoi(id)
239 if err != nil { 233 if err != nil {
240 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryEditFail, "ATOI: "+err.Error())
241 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 234 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
242 return 235 return
243 } 236 }
@@ -250,7 +243,6 @@ func DeleteMapSummary(c *gin.Context) {
250 // Start database transaction 243 // Start database transaction
251 tx, err := database.DB.Begin() 244 tx, err := database.DB.Begin()
252 if err != nil { 245 if err != nil {
253 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryDeleteFail, "TX#B: "+err.Error())
254 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 246 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
255 return 247 return
256 } 248 }
@@ -291,7 +283,6 @@ func DeleteMapSummary(c *gin.Context) {
291 return 283 return
292 } 284 }
293 if err = tx.Commit(); err != nil { 285 if err = tx.Commit(); err != nil {
294 CreateLog(user.(models.User).SteamID, LogTypeMod, LogDescriptionMapSummaryDeleteFail, "TX#C: "+err.Error())
295 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 286 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
296 return 287 return
297 } 288 }