Investigate the graph-ql middleware

This commit is contained in:
Wolfgang Huß 2021-08-10 10:56:12 +02:00
parent 02095274c7
commit f20643af3b
2 changed files with 11 additions and 1 deletions

View File

@ -76,5 +76,10 @@ export default {
AddEmailAddress: sendEmailVerificationMail, AddEmailAddress: sendEmailVerificationMail,
requestPasswordReset: sendPasswordResetMail, requestPasswordReset: sendPasswordResetMail,
Signup: sendSignupMail, Signup: sendSignupMail,
// Wolle
// CreatePost: handleContentDataOfPost,
// UpdatePost: handleContentDataOfPost,
// CreateComment: handleContentDataOfComment,
// UpdateComment: handleContentDataOfComment,
}, },
} }

View File

@ -6,11 +6,16 @@ const publishNotifications = async (...promises) => {
const notifications = await Promise.all(promises) const notifications = await Promise.all(promises)
notifications notifications
.flat() .flat()
.forEach((notificationAdded) => pubsub.publish(NOTIFICATION_ADDED, { notificationAdded })) .forEach((notificationAdded) => {
pubsub.publish(NOTIFICATION_ADDED, { notificationAdded })
// Wolle
// XXX send e-mails
})
} }
const handleContentDataOfPost = async (resolve, root, args, context, resolveInfo) => { const handleContentDataOfPost = async (resolve, root, args, context, resolveInfo) => {
const idsOfUsers = extractMentionedUsers(args.content) const idsOfUsers = extractMentionedUsers(args.content)
// Wolle console.log(context)
const post = await resolve(root, args, context, resolveInfo) const post = await resolve(root, args, context, resolveInfo)
if (post) { if (post) {
await publishNotifications( await publishNotifications(