Skip to content

Commit 48b1a23

Browse files
committed
chore: patch
1 parent 9d1b8cb commit 48b1a23

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

notification/controllers.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,28 @@ func TestNotification(c echo.Context) error {
2929

3030
e := postq.Event{
3131
Name: reqData.EventName,
32-
Properties: map[string]string{"id": reqData.ID.String()},
32+
Properties: map[string]string{"id": reqData.ID.String(), "event_name": reqData.EventName},
3333
CreatedAt: time.Now(),
3434
}
3535

3636
if err := addNotificationEvent(ctx, e); err != nil {
3737
return dutyAPI.WriteError(c, dutyAPI.Errorf(dutyAPI.EINTERNAL, "unable to create notification event: %v", err))
3838
}
3939

40+
var payload NotificationEventPayload
41+
payload.FromMap(e.Properties)
42+
43+
ctx.Debugf("[notification.send] %s ", payload.EventName)
44+
45+
notificationContext := NewContext(ctx, payload.NotificationID)
46+
notificationContext.WithSource(payload.EventName, payload.ID)
47+
48+
originalEvent := postq.Event{Name: payload.EventName, CreatedAt: payload.EventCreatedAt}
49+
celEnv, err := getEnvForEvent(ctx, originalEvent, e.Properties)
50+
if err != nil {
51+
}
52+
if err := SendNotification(notificationContext, payload, celEnv); err != nil {
53+
}
54+
4055
return c.JSON(http.StatusOK, dutyAPI.HTTPSuccess{Message: "success"})
4156
}

0 commit comments

Comments
 (0)