Skip to content

Commit

Permalink
Merge pull request #220 from ThatConference/fix/admin-event-emitter
Browse files Browse the repository at this point in the history
fix: use admin event emitter on admin session create
  • Loading branch information
brettski authored Oct 28, 2023
2 parents 737e657 + 60dd631 commit 4be2775
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "that-api-sessions",
"version": "4.3.0",
"version": "4.4.0",
"description": "THAT Conference Sessions Service.",
"main": "index.js",
"engines": {
Expand Down
6 changes: 0 additions & 6 deletions src/events/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,6 @@ function userEvents(postmark) {
userEventEmitter.on('sessionUpdated', setOgImage);
userEventEmitter.on('sessionUpdated', sendOrbitLoveActivtyOnUpdate);
userEventEmitter.on('sessionCancelled', cancelSharedCalendar);
// on admin events
userEventEmitter.on('adminSessionCreated', insertSharedCalendar);
userEventEmitter.on('adminSessionCreated', setOgImage);
userEventEmitter.on('adminSessionUpdated', updateSharedCalendar);
userEventEmitter.on('adminSessionUpdated', setOgImage);
userEventEmitter.on('adminSessionCancelled', cancelSharedCalendar);

return userEventEmitter;
}
Expand Down
24 changes: 12 additions & 12 deletions src/graphql/resolvers/mutations/adminSessionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ function sendUserEvent({
sessionResults,
userResults,
eventResults,
userEvents,
adminEvents,
user,
}) {
if (
(sessionResults.status === 'SUBMITTED' ||
sessionResults.status === 'ACCEPTED') &&
sessionResults.startTime
) {
userEvents.emit('adminSessionCreated', {
adminEvents.emit('sessionCreated', {
user: {
...user,
...userResults,
Expand Down Expand Up @@ -62,7 +62,7 @@ export const fieldResolvers = {
{
dataSources: {
firestore,
events: { userEvents, graphCdnEvents },
events: { adminEvents, graphCdnEvents },
},
user,
},
Expand All @@ -79,7 +79,7 @@ export const fieldResolvers = {
sessionResults,
userResults,
eventResults,
userEvents,
adminEvents,
user,
});
sendGraphCdnEvent({ graphCdnEvents, sessionResults });
Expand All @@ -92,7 +92,7 @@ export const fieldResolvers = {
{
dataSources: {
firestore,
events: { userEvents, graphCdnEvents },
events: { adminEvents, graphCdnEvents },
},
user,
},
Expand All @@ -109,7 +109,7 @@ export const fieldResolvers = {
sessionResults,
userResults,
eventResults,
userEvents,
adminEvents,
user,
});
sendGraphCdnEvent({ graphCdnEvents, sessionResults });
Expand All @@ -122,7 +122,7 @@ export const fieldResolvers = {
{
dataSources: {
firestore,
events: { userEvents, graphCdnEvents },
events: { adminEvents, graphCdnEvents },
},
user,
},
Expand All @@ -139,7 +139,7 @@ export const fieldResolvers = {
sessionResults,
userResults,
eventResults,
userEvents,
adminEvents,
user,
});
sendGraphCdnEvent({ graphCdnEvents, sessionResults });
Expand All @@ -152,7 +152,7 @@ export const fieldResolvers = {
{
dataSources: {
firestore,
events: { userEvents, graphCdnEvents },
events: { adminEvents, graphCdnEvents },
},
user,
},
Expand All @@ -169,7 +169,7 @@ export const fieldResolvers = {
sessionResults,
userResults,
eventResults,
userEvents,
adminEvents,
user,
});
sendGraphCdnEvent({ graphCdnEvents, sessionResults });
Expand All @@ -182,7 +182,7 @@ export const fieldResolvers = {
{
dataSources: {
firestore,
events: { userEvents, graphCdnEvents },
events: { adminEvents, graphCdnEvents },
},
user,
},
Expand All @@ -199,7 +199,7 @@ export const fieldResolvers = {
sessionResults,
userResults,
eventResults,
userEvents,
adminEvents,
user,
});
sendGraphCdnEvent({ graphCdnEvents, sessionResults });
Expand Down

0 comments on commit 4be2775

Please sign in to comment.