|
|
@ -170,6 +170,9 @@ func SignUp(c *gin.Context) { |
|
|
|
updateLoginRecord(c, user.ID, time.Now()) |
|
|
|
updateLoginRecord(c, user.ID, time.Now()) |
|
|
|
c.JSON(http.StatusOK, gin.H{}) |
|
|
|
c.JSON(http.StatusOK, gin.H{}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var totalRecord int64 // variabel global untuk menyimpan total record
|
|
|
|
|
|
|
|
|
|
|
|
func LogIn(c *gin.Context) { |
|
|
|
func LogIn(c *gin.Context) { |
|
|
|
var body struct { |
|
|
|
var body struct { |
|
|
|
Email string |
|
|
|
Email string |
|
|
@ -237,17 +240,7 @@ func LogIn(c *gin.Context) { |
|
|
|
c.SetCookie("Authorization", tokenString, 3600*24*30, "", "", false, true) |
|
|
|
c.SetCookie("Authorization", tokenString, 3600*24*30, "", "", false, true) |
|
|
|
|
|
|
|
|
|
|
|
// Menghitung total record setelah operasi save
|
|
|
|
// Menghitung total record setelah operasi save
|
|
|
|
var totalRecord int64 |
|
|
|
totalRecord++ |
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{ |
|
|
|
c.JSON(http.StatusOK, gin.H{ |
|
|
|
"code": http.StatusOK, |
|
|
|
"code": http.StatusOK, |
|
|
|