diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-28 18:40:58 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-28 18:40:58 +0300 |
| commit | b37e49da3698a3c92b214931a23dcdb1ac41587c (patch) | |
| tree | 569d8e3e7fdffe5dd67919ce82853aaed69f69e9 /backend/handlers/logs.go | |
| parent | fix: check for category id for map history when deleting summary (#106) (diff) | |
| download | lphub-b37e49da3698a3c92b214931a23dcdb1ac41587c.tar.gz lphub-b37e49da3698a3c92b214931a23dcdb1ac41587c.tar.bz2 lphub-b37e49da3698a3c92b214931a23dcdb1ac41587c.zip | |
feat: improve logs and mod log endpoint (#55)
Former-commit-id: 7f2d9100cc4bd78c27544909fe7215913d6a2dfe
Diffstat (limited to 'backend/handlers/logs.go')
| -rw-r--r-- | backend/handlers/logs.go | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/backend/handlers/logs.go b/backend/handlers/logs.go index 0a0b6be..23c4a39 100644 --- a/backend/handlers/logs.go +++ b/backend/handlers/logs.go | |||
| @@ -25,13 +25,14 @@ const ( | |||
| 25 | LogDescriptionUserUpdateCountrySuccess string = "UpdateCountrySuccess" | 25 | LogDescriptionUserUpdateCountrySuccess string = "UpdateCountrySuccess" |
| 26 | LogDescriptionUserUpdateCountryFail string = "UpdateCountryFail" | 26 | LogDescriptionUserUpdateCountryFail string = "UpdateCountryFail" |
| 27 | 27 | ||
| 28 | LogDescriptionMapSummaryCreateSuccess string = "MapSummaryCreateSuccess" | 28 | LogDescriptionMapSummaryCreateSuccess string = "MapSummaryCreateSuccess" |
| 29 | LogDescriptionMapSummaryCreateFail string = "MapSummaryCreateFail" | 29 | LogDescriptionMapSummaryCreateFail string = "MapSummaryCreateFail" |
| 30 | LogDescriptionMapSummaryEditSuccess string = "MapSummaryEditSuccess" | 30 | LogDescriptionMapSummaryEditSuccess string = "MapSummaryEditSuccess" |
| 31 | LogDescriptionMapSummaryEditFail string = "MapSummaryEditFail" | 31 | LogDescriptionMapSummaryEditFail string = "MapSummaryEditFail" |
| 32 | LogDescriptionMapSummaryEditImage string = "MapSummaryEditImage" | 32 | LogDescriptionMapSummaryEditImageSuccess string = "MapSummaryEditImageSuccess" |
| 33 | LogDescriptionMapSummaryDeleteSuccess string = "MapSummaryDeleteSuccess" | 33 | LogDescriptionMapSummaryEditImageFail string = "MapSummaryEditImageFail" |
| 34 | LogDescriptionMapSummaryDeleteFail string = "MapSummaryDeleteFail" | 34 | LogDescriptionMapSummaryDeleteSuccess string = "MapSummaryDeleteSuccess" |
| 35 | LogDescriptionMapSummaryDeleteFail string = "MapSummaryDeleteFail" | ||
| 35 | 36 | ||
| 36 | LogDescriptionCreateRecordSuccess string = "CreateRecordSuccess" | 37 | LogDescriptionCreateRecordSuccess string = "CreateRecordSuccess" |
| 37 | LogDescriptionCreateRecordInsertRecordFail string = "InsertRecordFail" | 38 | LogDescriptionCreateRecordInsertRecordFail string = "InsertRecordFail" |
| @@ -49,6 +50,7 @@ type Log struct { | |||
| 49 | User models.UserShort `json:"user"` | 50 | User models.UserShort `json:"user"` |
| 50 | Type string `json:"type"` | 51 | Type string `json:"type"` |
| 51 | Description string `json:"description"` | 52 | Description string `json:"description"` |
| 53 | Message string `json:"message"` | ||
| 52 | Date time.Time `json:"date"` | 54 | Date time.Time `json:"date"` |
| 53 | } | 55 | } |
| 54 | 56 | ||
| @@ -57,9 +59,10 @@ type LogsResponse struct { | |||
| 57 | } | 59 | } |
| 58 | 60 | ||
| 59 | type LogsResponseDetails struct { | 61 | type LogsResponseDetails struct { |
| 60 | User models.UserShort `json:"user"` | 62 | User models.UserShort `json:"user"` |
| 61 | Log string `json:"detail"` | 63 | Log string `json:"detail"` |
| 62 | Date time.Time `json:"date"` | 64 | Message string `json:"message"` |
| 65 | Date time.Time `json:"date"` | ||
| 63 | } | 66 | } |
| 64 | 67 | ||
| 65 | type ScoreLogsResponse struct { | 68 | type ScoreLogsResponse struct { |
| @@ -112,8 +115,9 @@ func ModLogs(c *gin.Context) { | |||
| 112 | SteamID: log.User.SteamID, | 115 | SteamID: log.User.SteamID, |
| 113 | UserName: log.User.UserName, | 116 | UserName: log.User.UserName, |
| 114 | }, | 117 | }, |
| 115 | Log: detail, | 118 | Log: detail, |
| 116 | Date: log.Date, | 119 | Message: log.Message, |
| 120 | Date: log.Date, | ||
| 117 | }) | 121 | }) |
| 118 | } | 122 | } |
| 119 | c.JSON(http.StatusOK, models.Response{ | 123 | c.JSON(http.StatusOK, models.Response{ |