✨ Provide API to try out our newest notification feature
This commit is contained in:
@ -3,6 +3,7 @@ package grpc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/samber/lo"
|
||||
@ -28,6 +29,8 @@ func (v *Server) NotifyUser(_ context.Context, in *proto.NotifyUserRequest) (*pr
|
||||
Subtitle: in.GetNotify().Subtitle,
|
||||
Body: in.GetNotify().GetBody(),
|
||||
Metadata: metadata,
|
||||
Avatar: in.GetNotify().Avatar,
|
||||
Picture: in.GetNotify().Picture,
|
||||
IsRealtime: in.GetNotify().GetIsRealtime(),
|
||||
IsForcePush: in.GetNotify().GetIsForcePush(),
|
||||
AccountID: user.ID,
|
||||
@ -68,6 +71,8 @@ func (v *Server) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReq
|
||||
Subtitle: in.GetNotify().Subtitle,
|
||||
Body: in.GetNotify().GetBody(),
|
||||
Metadata: metadata,
|
||||
Avatar: in.GetNotify().Avatar,
|
||||
Picture: in.GetNotify().Picture,
|
||||
IsRealtime: in.GetNotify().GetIsRealtime(),
|
||||
IsForcePush: in.GetNotify().GetIsForcePush(),
|
||||
AccountID: user.ID,
|
||||
@ -106,6 +111,8 @@ func (v *Server) NotifyAllUser(_ context.Context, in *proto.NotifyRequest) (*pro
|
||||
Subtitle: in.Subtitle,
|
||||
Body: in.GetBody(),
|
||||
Metadata: metadata,
|
||||
Avatar: in.Avatar,
|
||||
Picture: in.Picture,
|
||||
IsRealtime: in.GetIsRealtime(),
|
||||
IsForcePush: in.GetIsForcePush(),
|
||||
AccountID: user.ID,
|
||||
|
@ -16,6 +16,8 @@ func notifyAllUser(c *fiber.Ctx) error {
|
||||
Subtitle *string `json:"subtitle" validate:"max=1024"`
|
||||
Body string `json:"content" validate:"required,max=4096"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
Avatar *string `json:"avatar"`
|
||||
Picture *string `json:"picture"`
|
||||
IsForcePush bool `json:"is_force_push"`
|
||||
IsRealtime bool `json:"is_realtime"`
|
||||
}
|
||||
@ -45,6 +47,9 @@ func notifyAllUser(c *fiber.Ctx) error {
|
||||
Subtitle: data.Subtitle,
|
||||
Title: data.Title,
|
||||
Body: data.Body,
|
||||
Metadata: data.Metadata,
|
||||
Avatar: data.Avatar,
|
||||
Picture: data.Picture,
|
||||
IsRealtime: data.IsRealtime,
|
||||
IsForcePush: data.IsForcePush,
|
||||
AccountID: user.ID,
|
||||
|
@ -16,6 +16,8 @@ func notifyUser(c *fiber.Ctx) error {
|
||||
Subtitle *string `json:"subtitle" validate:"max=1024"`
|
||||
Body string `json:"content" validate:"required,max=4096"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
Avatar *string `json:"avatar"`
|
||||
Picture *string `json:"picture"`
|
||||
IsForcePush bool `json:"is_force_push"`
|
||||
IsRealtime bool `json:"is_realtime"`
|
||||
UserID uint `json:"user_id" validate:"required"`
|
||||
@ -40,6 +42,9 @@ func notifyUser(c *fiber.Ctx) error {
|
||||
Subtitle: data.Subtitle,
|
||||
Title: data.Title,
|
||||
Body: data.Body,
|
||||
Metadata: data.Metadata,
|
||||
Avatar: data.Avatar,
|
||||
Picture: data.Picture,
|
||||
IsRealtime: data.IsRealtime,
|
||||
IsForcePush: data.IsForcePush,
|
||||
AccountID: user.ID,
|
||||
|
Reference in New Issue
Block a user