🐛 Fix model relation issue
This commit is contained in:
@ -47,7 +47,7 @@ func notifyAllUser(c *fiber.Ctx) error {
|
||||
Body: data.Body,
|
||||
IsRealtime: data.IsRealtime,
|
||||
IsForcePush: data.IsForcePush,
|
||||
UserID: user.ID,
|
||||
AccountID: user.ID,
|
||||
}
|
||||
|
||||
if data.IsRealtime {
|
||||
@ -103,7 +103,7 @@ func notifyOneUser(c *fiber.Ctx) error {
|
||||
Body: data.Body,
|
||||
IsRealtime: data.IsRealtime,
|
||||
IsForcePush: data.IsForcePush,
|
||||
UserID: user.ID,
|
||||
AccountID: user.ID,
|
||||
}
|
||||
|
||||
if data.IsRealtime {
|
||||
|
@ -17,7 +17,7 @@ func getNotifications(c *fiber.Ctx) error {
|
||||
}
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
tx := database.C.Where(&models.Notification{UserID: user.ID}).Model(&models.Notification{})
|
||||
tx := database.C.Where(&models.Notification{AccountID: user.ID}).Model(&models.Notification{})
|
||||
|
||||
var count int64
|
||||
var notifications []models.Notification
|
||||
@ -53,7 +53,7 @@ func markNotificationRead(c *fiber.Ctx) error {
|
||||
var notify models.Notification
|
||||
if err := database.C.Where(&models.Notification{
|
||||
BaseModel: models.BaseModel{ID: uint(id)},
|
||||
UserID: user.ID,
|
||||
AccountID: user.ID,
|
||||
}).First(¬ify).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ func notifyUser(c *fiber.Ctx) error {
|
||||
Body: data.Body,
|
||||
IsRealtime: data.IsRealtime,
|
||||
IsForcePush: data.IsForcePush,
|
||||
UserID: user.ID,
|
||||
AccountID: user.ID,
|
||||
SenderID: &client.ID,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user