Skip to content

Commit

Permalink
feat(service.go): add publishing of content creation and update events
Browse files Browse the repository at this point in the history
The `StoreContent` and `UpdateContent` methods in the `ContentService`
now publish events when content is created or updated. This allows other
parts of the application to be notified of these events and take
appropriate actions.
  • Loading branch information
cybersiddhu committed Nov 3, 2023
1 parent f67c07d commit e93b805
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/app/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ func (srv *ContentService) StoreContent(
return ctnt, aphgrpc.HandleGetError(ctx, err)
}
cid, _ := strconv.ParseInt(mcont.Key, 10, 64)
ctnt = srv.buildContent(cid, mcont)
//nolint:errcheck
srv.publisher.Publish(srv.Topics["contentCreate"], ctnt)

return srv.buildContent(cid, mcont), nil
return ctnt, nil
}

func (srv *ContentService) UpdateContent(
Expand All @@ -157,8 +160,11 @@ func (srv *ContentService) UpdateContent(
return ctnt, aphgrpc.HandleGetError(ctx, err)
}
cid, _ := strconv.ParseInt(mcont.Key, 10, 64)
ctnt = srv.buildContent(cid, mcont)
//nolint:errcheck
srv.publisher.Publish(srv.Topics["contentUpdate"], ctnt)

return srv.buildContent(cid, mcont), nil
return ctnt, nil
}

func (srv *ContentService) DeleteContent(
Expand Down

0 comments on commit e93b805

Please sign in to comment.