|
|
|
@ -170,6 +170,9 @@ func SignUp(c *gin.Context) {
|
|
|
|
|
updateLoginRecord(c, user.ID, time.Now()) |
|
|
|
|
c.JSON(http.StatusOK, gin.H{}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var totalRecord int64 // variabel global untuk menyimpan total record
|
|
|
|
|
|
|
|
|
|
func LogIn(c *gin.Context) { |
|
|
|
|
var body struct { |
|
|
|
|
Email string |
|
|
|
@ -237,17 +240,7 @@ func LogIn(c *gin.Context) {
|
|
|
|
|
c.SetCookie("Authorization", tokenString, 3600*24*30, "", "", false, true) |
|
|
|
|
|
|
|
|
|
// Menghitung total record setelah operasi save
|
|
|
|
|
var totalRecord int64 |
|
|
|
|
result = initializers.DB.Model(models.Post{}).Count(&totalRecord) |
|
|
|
|
if result.Error != nil { |
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{ |
|
|
|
|
"code": http.StatusInternalServerError, |
|
|
|
|
"data": nil, |
|
|
|
|
"message": "Failed to fetch total record", |
|
|
|
|
"status": false, |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
totalRecord++ |
|
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{ |
|
|
|
|
"code": http.StatusOK, |
|
|
|
|