✨ Provide API to try out our newest notification feature
This commit is contained in:
parent
8fcaf99103
commit
b3bb7cb582
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ toolchain go1.22.1
|
||||
|
||||
require (
|
||||
firebase.google.com/go v3.13.0+incompatible
|
||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a
|
||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65
|
||||
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745
|
||||
github.com/go-playground/validator/v10 v10.17.0
|
||||
github.com/gofiber/fiber/v2 v2.52.4
|
||||
|
2
go.sum
2
go.sum
@ -19,6 +19,8 @@ firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVA
|
||||
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
|
||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a h1:08YaBgZtkrPfiw08l4RjtKI1fdt6wlHc3Ea7NDFtLPg=
|
||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA=
|
||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65 h1:p9PIsp5RyrLdlOR7MXyeGBx04v3+1IMEEBBV22fJZPo=
|
||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA=
|
||||
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 h1:40BUsQMNXjqHyytkyF9py1HjTAWlRgO6R57YXUrHNy4=
|
||||
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745/go.mod h1:FsQGSLTl0gvo+9Jmbot02S72suyF9tFTrzDj70Xhifo=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user