fix: scope notifications by tenant
This commit is contained in:
@@ -3,10 +3,11 @@ package args
|
||||
import "github.com/riverqueue/river"
|
||||
|
||||
type NotificationArgs struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
func (NotificationArgs) Kind() string {
|
||||
|
||||
@@ -17,11 +17,12 @@ type NotificationWorker struct {
|
||||
func (j *NotificationWorker) Work(ctx context.Context, job *river.Job[args.NotificationArgs]) error {
|
||||
arg := job.Args
|
||||
n := &models.Notification{
|
||||
UserID: arg.UserID,
|
||||
Type: arg.Type,
|
||||
Title: arg.Title,
|
||||
Content: arg.Content,
|
||||
IsRead: false,
|
||||
TenantID: arg.TenantID,
|
||||
UserID: arg.UserID,
|
||||
Type: arg.Type,
|
||||
Title: arg.Title,
|
||||
Content: arg.Content,
|
||||
IsRead: false,
|
||||
}
|
||||
return models.NotificationQuery.WithContext(ctx).Create(n)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user