all repos — caroster @ 28cc15baec7467adf5ddb57622fb07fd8d97646b

[Octree] Group carpool to your event https://caroster.io

feat: :sparkles: Notify all admins on invite for Caroster Plus
Tim Izzo tim@octree.ch
Fri, 12 Jul 2024 11:56:40 +0200
commit

28cc15baec7467adf5ddb57622fb07fd8d97646b

parent

c938f6d09213822e418659e119ad87b40ee923e4

1 files changed, 11 insertions(+), 3 deletions(-)

jump to
M backend/src/graphql/event/administrators.tsbackend/src/graphql/event/administrators.ts

@@ -27,7 +27,8 @@ }),

], resolvers: { Event: { - administrators: (event) => event.administrators?.split(/, ?/).filter(Boolean) || [], + administrators: (event) => + event.administrators?.split(/, ?/).filter(Boolean) || [], }, Mutation: { addEventAdmin: {

@@ -39,7 +40,8 @@ args.eventId

); if (!event) throw new errors.NotFoundError(`Event not found`); - const currentAdmins = event.administrators?.split(/, ?/).filter(Boolean) || []; + const currentAdmins = + event.administrators?.split(/, ?/).filter(Boolean) || []; // Check if user is authorized to add event admin const user = context.state.user;

@@ -73,10 +75,16 @@ event: args.eventId,

user: targetedUser.id, }, }); - } else + } else { strapi.log.warn( `No user with email '${args.email}'. Can't create notification AddedAsAdmin for event ${args.eventId}` ); + strapi + .service("api::email.email") + .sendEmailNotif(args.email, "AddedAsAdmin", event.lang, { + event, + }); + } // Send formated response const { toEntityResponse } = strapi