|
|
|
@ -220,7 +220,11 @@ func GetLoginRecords(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
if result.Error != nil { |
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{ |
|
|
|
|
"error": "Failed to fetch login records", |
|
|
|
|
"code": http.StatusInternalServerError, |
|
|
|
|
"data": nil, |
|
|
|
|
"message": "Failed to fetch login records", |
|
|
|
|
"status": false, |
|
|
|
|
"totalRecord": 0, |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -235,9 +239,18 @@ func GetLoginRecords(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
// Create JSON response
|
|
|
|
|
var response struct { |
|
|
|
|
Records []models.LoginRecord `json:"records"` |
|
|
|
|
Code int `json:"code"` |
|
|
|
|
Data []models.LoginRecord `json:"data"` |
|
|
|
|
Message string `json:"message"` |
|
|
|
|
Status bool `json:"status"` |
|
|
|
|
TotalRecord int `json:"totalRecord"` |
|
|
|
|
} |
|
|
|
|
response.Records = loginRecords |
|
|
|
|
|
|
|
|
|
response.Code = http.StatusOK |
|
|
|
|
response.Data = loginRecords |
|
|
|
|
response.Message = "OK" |
|
|
|
|
response.Status = true |
|
|
|
|
response.TotalRecord = len(loginRecords) |
|
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, response) |
|
|
|
|
} |
|
|
|
|