✨ Support firebase FCM as a notify subscriber
This commit is contained in:
@ -8,12 +8,13 @@ import (
|
||||
|
||||
func notifyUser(c *fiber.Ctx) error {
|
||||
var data struct {
|
||||
ClientID string `json:"client_id" validate:"required"`
|
||||
ClientSecret string `json:"client_secret" validate:"required"`
|
||||
Subject string `json:"subject" validate:"required,max=1024"`
|
||||
Content string `json:"content" validate:"required,max=3072"`
|
||||
IsImportant bool `json:"is_important"`
|
||||
UserID uint `json:"user_id" validate:"required"`
|
||||
ClientID string `json:"client_id" validate:"required"`
|
||||
ClientSecret string `json:"client_secret" validate:"required"`
|
||||
Subject string `json:"subject" validate:"required,max=1024"`
|
||||
Content string `json:"content" validate:"required,max=3072"`
|
||||
Links []models.NotificationLink `json:"links"`
|
||||
IsImportant bool `json:"is_important"`
|
||||
UserID uint `json:"user_id" validate:"required"`
|
||||
}
|
||||
|
||||
if err := BindAndValidate(c, &data); err != nil {
|
||||
@ -30,7 +31,7 @@ func notifyUser(c *fiber.Ctx) error {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
if err := services.NewNotification(client, user, data.Subject, data.Content, data.IsImportant); err != nil {
|
||||
if err := services.NewNotification(client, user, data.Subject, data.Content, data.Links, data.IsImportant); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user