Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish Dangi committed Oct 7, 2024
1 parent 2568886 commit 53ac6c9
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions internal/api/v1beta1/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,24 @@ func (s *GRPCServer) PostNotification(ctx context.Context, req *sirenv1beta1.Pos
}, nil
}

func (s *GRPCServer) convertNotificationToPb(n notification.Notification) (*sirenv1beta1.Notification, error) {
pbData, err := structpb.NewStruct(n.Data)
if err != nil {
return nil, errors.ErrInternal.WithMsgf("failed to convert notification data to protobuf: %v", err)
}

return &sirenv1beta1.Notification{
Id: n.ID,
NamespaceId: n.NamespaceID,
Type: n.Type,
Data: pbData,
Labels: n.Labels,
ValidDuration: durationpb.New(n.ValidDuration),
Template: n.Template,
CreateAt: timestamppb.New(n.CreatedAt),
UniqueKey: n.UniqueKey,
}, nil
}
// func (s *GRPCServer) convertNotificationToPb(n notification.Notification) (*sirenv1beta1.Notification, error) {
// pbData, err := structpb.NewStruct(n.Data)
// if err != nil {
// return nil, errors.ErrInternal.WithMsgf("failed to convert notification data to protobuf: %v", err)
// }

// return &sirenv1beta1.Notification{
// Id: n.ID,
// NamespaceId: n.NamespaceID,
// Type: n.Type,
// Data: pbData,
// Labels: n.Labels,
// ValidDuration: durationpb.New(n.ValidDuration),
// Template: n.Template,
// CreateAt: timestamppb.New(n.CreatedAt),
// UniqueKey: n.UniqueKey,
// }, nil
// }

func (s *GRPCServer) PostBulkNotifications(ctx context.Context, req *sirenv1beta1.PostBulkNotificationsRequest) (*sirenv1beta1.PostBulkNotificationsResponse, error) {
if len(req.GetNotifications()) == 0 {
Expand Down

0 comments on commit 53ac6c9

Please sign in to comment.