Skip to content

Commit 418f224

Browse files
authored
Merge pull request #490 from topcoder-platform/feature/notifications-api
[DEV] Notifications part 2
2 parents 16cc100 + dcbef2c commit 418f224

29 files changed

+13054
-159
lines changed

app-constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
const UserRoles = {
66
BookingManager: 'bookingmanager',
77
Administrator: 'administrator',
8-
ConnectManager: 'Connect Manager'
8+
ConnectManager: 'Connect Manager',
9+
TopcoderUser: 'Topcoder User'
910
}
1011

1112
const FullManagePermissionRoles = [

app.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const eventHandlers = require('./src/eventHandlers')
1515
const interviewService = require('./src/services/InterviewService')
1616
const { processScheduler } = require('./src/services/PaymentSchedulerService')
1717
const { sendSurveys } = require('./src/services/SurveyService')
18-
const emailNotificationService = require('./src/services/EmailNotificationService')
18+
const notificationSchedulerService = require('./src/services/NotificationsSchedulerService')
1919
const { WeeklySurveySwitch } = require('./app-constants')
2020

2121
// setup express app
@@ -108,11 +108,11 @@ const server = app.listen(app.get('port'), () => {
108108
// schedule payment processing
109109
schedule.scheduleJob(config.PAYMENT_PROCESSING.CRON, processScheduler)
110110

111-
schedule.scheduleJob(config.CRON_CANDIDATE_REVIEW, emailNotificationService.sendCandidatesAvailableEmails)
112-
schedule.scheduleJob(config.CRON_INTERVIEW_COMING_UP, emailNotificationService.sendInterviewComingUpEmails)
113-
schedule.scheduleJob(config.CRON_INTERVIEW_COMPLETED, emailNotificationService.sendInterviewCompletedEmails)
114-
schedule.scheduleJob(config.CRON_POST_INTERVIEW, emailNotificationService.sendPostInterviewActionEmails)
115-
schedule.scheduleJob(config.CRON_UPCOMING_RESOURCE_BOOKING, emailNotificationService.sendResourceBookingExpirationEmails)
111+
schedule.scheduleJob(config.CRON_CANDIDATE_REVIEW, notificationSchedulerService.sendCandidatesAvailableNotifications)
112+
schedule.scheduleJob(config.CRON_INTERVIEW_COMING_UP, notificationSchedulerService.sendInterviewComingUpNotifications)
113+
schedule.scheduleJob(config.CRON_INTERVIEW_COMPLETED, notificationSchedulerService.sendInterviewCompletedNotifications)
114+
schedule.scheduleJob(config.CRON_POST_INTERVIEW, notificationSchedulerService.sendPostInterviewActionNotifications)
115+
schedule.scheduleJob(config.CRON_UPCOMING_RESOURCE_BOOKING, notificationSchedulerService.sendResourceBookingExpirationNotifications)
116116
})
117117

118118
if (process.env.NODE_ENV === 'test') {

config/default.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ module.exports = {
144144
TAAS_ROLE_UPDATE_TOPIC: process.env.TAAS_ROLE_UPDATE_TOPIC || 'taas.role.update',
145145
// the delete role entity Kafka message topic
146146
TAAS_ROLE_DELETE_TOPIC: process.env.TAAS_ROLE_DELETE_TOPIC || 'taas.role.delete',
147+
// the create team entity message topic, only used for eventHandler
148+
TAAS_TEAM_CREATE_TOPIC: process.env.TAAS_TEAM_CREATE_TOPIC || 'taas.team.create',
147149
// special kafka topics
148150
TAAS_ACTION_RETRY_TOPIC: process.env.TAAS_ACTION_RETRY_TOPIC || 'taas.action.retry',
149151

@@ -163,6 +165,10 @@ module.exports = {
163165
// INTERVIEW_INVITATION_RECIPIENTS_LIST may contain comma-separated list of email which is converted to array
164166
// scheduler@x.ai should be in the RECIPIENTS list
165167
INTERVIEW_INVITATION_RECIPIENTS_LIST: (process.env.INTERVIEW_INVITATION_RECIPIENTS_LIST || 'scheduler@topcoder.com').split(','),
168+
// the emails address for overlapping interview
169+
NOTIFICATION_OPS_EMAILS: (process.env.NOTIFICATION_OPS_EMAILS || 'overlapping@topcoder.com').split(','),
170+
// the slack channel for sending notifications
171+
NOTIFICATION_SLACK_CHANNEL: process.env.NOTIFICATION_SLACK_CHANNEL || '#tass-notification',
166172
// SendGrid email template ID for reporting issue
167173
REPORT_ISSUE_SENDGRID_TEMPLATE_ID: process.env.REPORT_ISSUE_SENDGRID_TEMPLATE_ID,
168174
// SendGrid email template ID for requesting extension

config/email_template.config.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ module.exports = {
111111
* List all kind of emails which could be send as Email Notifications by scheduler, API endpoints or anything else.
112112
*/
113113
notificationEmailTemplates: {
114+
'taas.notification.job-candidate-resume-viewed': {
115+
subject: 'Topcoder - Client View Resume for Job {{jobName}}',
116+
body: '',
117+
recipients: [],
118+
from: config.NOTIFICATION_SENDER_EMAIL,
119+
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
120+
},
114121
'taas.notification.candidates-available-for-review': {
115122
subject: 'Topcoder - {{teamName}} has job candidates available for review',
116123
body: '',
@@ -152,6 +159,41 @@ module.exports = {
152159
recipients: [],
153160
from: config.NOTIFICATION_SENDER_EMAIL,
154161
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
162+
},
163+
'taas.notification.team-created': {
164+
subject: 'Topcoder - New Team {{teamName}} Created',
165+
body: '',
166+
recipients: [],
167+
from: config.NOTIFICATION_SENDER_EMAIL,
168+
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
169+
},
170+
'taas.notification.job-created': {
171+
subject: 'Topcoder - New Job {{jobTitle}} Created in Team {{teamName}}',
172+
body: '',
173+
recipients: [],
174+
from: config.NOTIFICATION_SENDER_EMAIL,
175+
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
176+
},
177+
'taas.notification.interviews-overlapping': {
178+
subject: 'Topcoder - Interviews overlapping',
179+
body: '',
180+
recipients: config.NOTIFICATION_OPS_EMAILS,
181+
from: config.NOTIFICATION_SENDER_EMAIL,
182+
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
183+
},
184+
'taas.notification.job-candidate-selected': {
185+
subject: 'Topcoder - Job Candidate {{userHandle}} Selected for {{jobTitle}} in Team {{teamName}}',
186+
body: '',
187+
recipients: config.NOTIFICATION_OPS_EMAILS,
188+
from: config.NOTIFICATION_SENDER_EMAIL,
189+
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
190+
},
191+
'taas.notification.resource-booking-placed': {
192+
subject: 'Topcoder - Resource Booking {{userHandle}} Placed for Job {{jobTitle}} in Team {{teamName}}',
193+
body: '',
194+
recipients: [],
195+
from: config.NOTIFICATION_SENDER_EMAIL,
196+
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
155197
}
156198
}
157199
}

0 commit comments

Comments
 (0)