diff --git a/khelo/functions/src/index.js b/khelo/functions/src/index.js index 37069684..813ae302 100644 --- a/khelo/functions/src/index.js +++ b/khelo/functions/src/index.js @@ -31,7 +31,6 @@ const teamRepository = new team_repository.TeamRepository(db); const notificationService = new notification_service.NotificationService(userRepository); const teamService = new team_service.TeamService(userRepository, notificationService); const matchService = new match_service.MatchService(userRepository, teamRepository, notificationService); -const mailService = new mail_service.MailService(db); const matchRepository = new match_repository.MatchRepository(db, matchService); @@ -51,6 +50,20 @@ exports.fiveMinuteCron = (0, scheduler.onSchedule)({timeZone: exports.TIMEZONE, await matchRepository.processUpcomingMatches(); }); -exports.sendSupportRequest = onCall({ region: "asia-south1" }, async (request) => { - await mailService.sendMail(request.data); +exports.sendSupportRequest = onCall({ region: "asia-south1"}, async (request) => { + + const db = admin.firestore(); + var data = request.data; + + await db.collection('support_requests') + .add({ + to: ["radhika.s@canopas.com", "megh.l@canopas.com"], + template: { + name: "support_request", + data: { + request: data + }, + }, + }).then(() => console.log('Queued email for delivery!')); + }); diff --git a/khelo/functions/src/mail/mail_service.js b/khelo/functions/src/mail/mail_service.js deleted file mode 100644 index c7419f8b..00000000 --- a/khelo/functions/src/mail/mail_service.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MailService = void 0; - -class MailService { - constructor(db) { - this.db = db; - } - async sendMail(data) { - return await this.db.collection('support_requests') - .add({ - to: ["sidhdhi.p@canopas.com", "mayank.v@canopas.com"], - template: { - name: "support_request", - data: { - request: data - }, - }, - }).then(() => console.log('Queued email for delivery!')); - } - -} - -exports.MailService = MailService; \ No newline at end of file