Skip to content

Deploy to Production for Interview Scheduler #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2754bc4
feat: add interview scheduler
cagdas001 Apr 22, 2021
75ddf18
Merge branch 'feature/interview-scheduler2' of https://github.com/cag…
cagdas001 Apr 22, 2021
a5d52cb
Merge pull request #215 from cagdas001/feature/interview-scheduler2
nikolay83 Apr 22, 2021
a663d96
Merge branch 'dev' of https://github.com/topcoder-platform/taas-apis …
cagdas001 Apr 22, 2021
9e294ac
Merge pull request #219 from cagdas001/feature/interview-scheduler2
nikolay83 Apr 25, 2021
8e2a5a0
feat(interview-scheduler): frontend integration
cagdas001 Apr 27, 2021
7634476
Merge pull request #225 from cagdas001/feature/interview-scheduler2
nikolay83 Apr 27, 2021
9b17328
Merge pull request #226 from topcoder-platform/feature/interview-sche…
urwithat Apr 28, 2021
de3b4d3
fix: migration JC status
maxceem Apr 28, 2021
e563947
Merge branch 'dev-wp' into dev
maxceem Apr 28, 2021
3992a6c
Interview changes from, recipients, & cc
urwithat Apr 28, 2021
48225d8
Passing new SendEmail properties
urwithat Apr 28, 2021
03f5bf5
Send Email Template Fix's
urwithat Apr 28, 2021
f86289e
fix
urwithat Apr 28, 2021
14715c6
Fix from not an array
urwithat Apr 28, 2021
2a079f5
fix(interview-scheduler): fix interview permissions & mail feature
cagdas001 Apr 29, 2021
765d3fa
Merge pull request #228 from cagdas001/dev
urwithat Apr 30, 2021
c6961f8
Changes for new sendgrid template
urwithat Apr 30, 2021
898ba71
Fix for new sendgrid template
urwithat Apr 30, 2021
2d08648
Fix for new sendgrid template
urwithat Apr 30, 2021
0b57894
Import lodash
urwithat Apr 30, 2021
0611e65
fix(interview-scheduler): await getJob promise
cagdas001 Apr 30, 2021
788d014
Merge pull request #230 from cagdas001/dev
urwithat Apr 30, 2021
5b7212f
feat(interview-scheduler): add a limit on max. allowed rounds
cagdas001 May 1, 2021
8eca930
Merge pull request #231 from cagdas001/dev-2
urwithat May 1, 2021
6f139ac
fix: Job assigned auto-logic
maxceem May 1, 2021
969b137
fix: lint
maxceem May 1, 2021
bccba30
Missing subject and body in template & send email
urwithat May 3, 2021
ac8471e
Moving Subject and Body inside data attribute
urwithat May 3, 2021
813935b
Substitute the Subject and Body with values
urwithat May 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
AUTH0_AUDIENCE_UBAHN=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=

# necessary if you'll utilize email functionality of interviews
INTERVIEW_INVITATION_SENDGRID_TEMPLATE_ID=
INTERVIEW_INVITATION_SENDER_EMAIL=
# Locally deployed services (via docker-compose)
ES_HOST=dockerhost:9200
DATABASE_URL=postgres://postgres:postgres@dockerhost:5432/postgres
Expand Down
26 changes: 25 additions & 1 deletion app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,30 @@ const Scopes = {
READ_WORK_PERIOD_PAYMENT: 'read:taas-workPeriodPayments',
CREATE_WORK_PERIOD_PAYMENT: 'create:taas-workPeriodPayments',
UPDATE_WORK_PERIOD_PAYMENT: 'update:taas-workPeriodPayments',
ALL_WORK_PERIOD_PAYMENT: 'all:taas-workPeriodPayments'
ALL_WORK_PERIOD_PAYMENT: 'all:taas-workPeriodPayments',
// interview
READ_INTERVIEW: 'read:taas-interviews',
CREATE_INTERVIEW: 'create:taas-interviews',
UPDATE_INTERVIEW: 'update:taas-interviews',
ALL_INTERVIEW: 'all:taas-interviews'
}

// Interview related constants
const Interviews = {
Status: {
Scheduling: 'Scheduling',
Scheduled: 'Scheduled',
RequestedForReschedule: 'Requested for reschedule',
Rescheduled: 'Rescheduled',
Completed: 'Completed',
Cancelled: 'Cancelled'
},
// key: template name in x.ai, value: duration
XaiTemplate: {
'interview-30': 30,
'interview-60': 60
},
MaxAllowedCount: 3
}

const ChallengeStatus = {
Expand All @@ -62,6 +85,7 @@ module.exports = {
UserRoles,
FullManagePermissionRoles,
Scopes,
Interviews,
ChallengeStatus,
PaymentProcessingSwitch
}
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ const express = require('express')
const cors = require('cors')
const HttpStatus = require('http-status-codes')
const interceptor = require('express-interceptor')
const schedule = require('node-schedule')
const logger = require('./src/common/logger')
const eventHandlers = require('./src/eventHandlers')
const interviewService = require('./src/services/InterviewService')

// setup express app
const app = express()
Expand Down Expand Up @@ -93,6 +95,8 @@ app.use((err, req, res, next) => {
const server = app.listen(app.get('port'), () => {
logger.info({ component: 'app', message: `Express server listening on port ${app.get('port')}` })
eventHandlers.init()
// schedule updateCompletedInterviews to run every hour
schedule.scheduleJob('0 0 * * * *', interviewService.updateCompletedInterviews)
})

if (process.env.NODE_ENV === 'test') {
Expand Down
17 changes: 17 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ module.exports = {
TAAS_WORK_PERIOD_PAYMENT_UPDATE_TOPIC: process.env.TAAS_WORK_PERIOD_PAYMENT_UPDATE_TOPIC || 'taas.workperiodpayment.update',
// the delete work period payment entity Kafka message topic
TAAS_WORK_PERIOD_PAYMENT_DELETE_TOPIC: process.env.TAAS_WORK_PERIOD_PAYMENT_DELETE_TOPIC || 'taas.workperiodpayment.delete',
// topics for interview service
// the request interview Kafka message topic
TAAS_INTERVIEW_REQUEST_TOPIC: process.env.TAAS_INTERVIEW_REQUEST_TOPIC || 'taas.interview.requested',
// the interview update Kafka message topic
TAAS_INTERVIEW_UPDATE_TOPIC: process.env.TAAS_INTERVIEW_UPDATE_TOPIC || 'taas.interview.update',
// the interview bulk update Kafka message topic
TAAS_INTERVIEW_BULK_UPDATE_TOPIC: process.env.TAAS_INTERVIEW_BULK_UPDATE_TOPIC || 'taas.interview.bulkUpdate',

// the Kafka message topic for sending email
EMAIL_TOPIC: process.env.EMAIL_TOPIC || 'external.action.email',
Expand All @@ -135,10 +142,20 @@ module.exports = {
// the emails address for receiving the issue report
// REPORT_ISSUE_EMAILS may contain comma-separated list of email which is converted to array
REQUEST_EXTENSION_EMAILS: (process.env.REQUEST_EXTENSION_EMAILS || '').split(','),
// the emails address for interview invitation
// INTERVIEW_INVITATION_CC_LIST may contain comma-separated list of email which is converted to array
INTERVIEW_INVITATION_CC_LIST: (process.env.INTERVIEW_INVITATION_CC_LIST || '').split(','),
// INTERVIEW_INVITATION_RECIPIENTS_LIST may contain comma-separated list of email which is converted to array
// scheduler@x.ai should be in the RECIPIENTS list
INTERVIEW_INVITATION_RECIPIENTS_LIST: (process.env.INTERVIEW_INVITATION_RECIPIENTS_LIST || 'scheduler@topcoder.com').split(','),
// SendGrid email template ID for reporting issue
REPORT_ISSUE_SENDGRID_TEMPLATE_ID: process.env.REPORT_ISSUE_SENDGRID_TEMPLATE_ID,
// SendGrid email template ID for requesting extension
REQUEST_EXTENSION_SENDGRID_TEMPLATE_ID: process.env.REQUEST_EXTENSION_SENDGRID_TEMPLATE_ID,
// SendGrid email template ID for interview invitation
INTERVIEW_INVITATION_SENDGRID_TEMPLATE_ID: process.env.INTERVIEW_INVITATION_SENDGRID_TEMPLATE_ID,
// The sender (aka `from`) email for invitation.
INTERVIEW_INVITATION_SENDER_EMAIL: process.env.INTERVIEW_INVITATION_SENDER_EMAIL || 'talent@topcoder.com',
// the URL where TaaS App is hosted
TAAS_APP_URL: process.env.TAAS_APP_URL || 'https://platform.topcoder-dev.com/taas/myteams',
// environment variables for Payment Service
Expand Down
39 changes: 39 additions & 0 deletions config/email_template.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,44 @@ module.exports = {
'{{text}}',
recipients: config.REPORT_ISSUE_EMAILS,
sendgridTemplateId: config.REQUEST_EXTENSION_SENDGRID_TEMPLATE_ID
},

/* Request interview for a job candidate
*
* - interviewType: the x.ai interview type. Example: "interview-30"
* - interviewRound: the round of the interview. Example: 2
* - interviewDuration: duration of the interview, in minutes. Example: 30
* - interviewerList: The list of interviewer email addresses. Example: "first@attendee.com, second@attendee.com"
* - candidateId: the id of the jobCandidate. Example: "cc562545-7b75-48bf-87e7-50b3c57e41b1"
* - candidateName: Full name of candidate. Example: "John Doe"
* - jobName: The title of the job. Example: "TaaS API Misc Updates"
*
* Template (defined in SendGrid):
* Subject: '{{interviewType}} tech interview with {{candidateName}} for {{jobName}} is requested by the Customer'
* Body:
* 'Hello!
* <br /><br />
* Congratulations, you have been selected to participate in a Topcoder Gig Work Interview!
* <br /><br />
* Please monitor your email for a response to this where you can coordinate your availability.
* <br /><br />
* Interviewee: {{candidateName}}<br />
* Interviewer(s): {{interviewerList}}<br />
* Interview Length: {{interviewDuration}} minutes
* <br /><br />
* /{{interviewType}}
* <br /><br />
* Topcoder Info:<br />
* Note: "id: {{candidateId}}, round: {{interviewRound}}"'
*
* Note, that the template should be defined in SendGrid.
* The subject & body above (identical to actual SendGrid template) is for reference purposes.
* We won't pass subject & body but only substitutions (replacements in template subject/body).
*/
'interview-invitation': {
from: config.INTERVIEW_INVITATION_SENDER_EMAIL,
cc: config.INTERVIEW_INVITATION_CC_LIST,
recipients: config.INTERVIEW_INVITATION_RECIPIENTS_LIST,
sendgridTemplateId: config.INTERVIEW_INVITATION_SENDGRID_TEMPLATE_ID
}
}
2,387 changes: 2,386 additions & 1 deletion data/demo-data.json

Large diffs are not rendered by default.

Loading