Skip to content

Commit

Permalink
Merge pull request #503 from topcoder-platform/dev
Browse files Browse the repository at this point in the history
[PROD] Next Release
  • Loading branch information
urwithat authored Aug 19, 2021
2 parents 136a574 + a65cffc commit 5ca8b61
Show file tree
Hide file tree
Showing 31 changed files with 13,123 additions and 213 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ workflows:
only:
- dev
- change-validatations-in-job-jc
- feature/enriching-skills-data-with-api-2

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
13 changes: 10 additions & 3 deletions app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
const UserRoles = {
BookingManager: 'bookingmanager',
Administrator: 'administrator',
ConnectManager: 'Connect Manager'
ConnectManager: 'Connect Manager',
TopcoderUser: 'Topcoder User'
}

const FullManagePermissionRoles = [
Expand Down Expand Up @@ -113,11 +114,11 @@ const WorkPeriodPaymentStatus = {
* The top rule has priority over the bottom rules.
*/
const PaymentStatusRules = [
{ paymentStatus: AggregatePaymentStatus.NO_DAYS, condition: { daysWorked: 0 } },
{ paymentStatus: AggregatePaymentStatus.IN_PROGRESS, condition: { hasWorkPeriodPaymentStatus: [WorkPeriodPaymentStatus.SCHEDULED, WorkPeriodPaymentStatus.IN_PROGRESS] } },
{ paymentStatus: AggregatePaymentStatus.COMPLETED, condition: { hasWorkPeriodPaymentStatus: [WorkPeriodPaymentStatus.COMPLETED], hasDueDays: false } },
{ paymentStatus: AggregatePaymentStatus.PARTIALLY_COMPLETED, condition: { hasWorkPeriodPaymentStatus: [WorkPeriodPaymentStatus.COMPLETED], hasDueDays: true } },
{ paymentStatus: AggregatePaymentStatus.PENDING, condition: { hasDueDays: true } }
{ paymentStatus: AggregatePaymentStatus.PENDING, condition: { hasDueDays: true } },
{ paymentStatus: AggregatePaymentStatus.NO_DAYS, condition: { daysWorked: 0 } }
]

/**
Expand All @@ -143,6 +144,11 @@ const PaymentProcessingSwitch = {
OFF: 'OFF'
}

const WeeklySurveySwitch = {
ON: 'ON',
OFF: 'OFF'
}

const PaymentSchedulerStatus = {
START_PROCESS: 'start-process',
CREATE_CHALLENGE: 'create-challenge',
Expand Down Expand Up @@ -172,6 +178,7 @@ module.exports = {
PaymentSchedulerStatus,
PaymentProcessingSwitch,
PaymentStatusRules,
WeeklySurveySwitch,
ActiveWorkPeriodPaymentStatuses,
JobStatus,
JobCandidateStatus
Expand Down
17 changes: 10 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const eventHandlers = require('./src/eventHandlers')
const interviewService = require('./src/services/InterviewService')
const { processScheduler } = require('./src/services/PaymentSchedulerService')
const { sendSurveys } = require('./src/services/SurveyService')
const emailNotificationService = require('./src/services/EmailNotificationService')
const notificationSchedulerService = require('./src/services/NotificationsSchedulerService')
const { WeeklySurveySwitch } = require('./app-constants')

// setup express app
const app = express()
Expand Down Expand Up @@ -101,15 +102,17 @@ const server = app.listen(app.get('port'), () => {
// schedule updateCompletedInterviews to run every hour
schedule.scheduleJob('0 0 * * * *', interviewService.updateCompletedInterviews)
// schedule sendSurveys
schedule.scheduleJob(config.WEEKLY_SURVEY.CRON, sendSurveys)
if (WeeklySurveySwitch.ON === config.WEEKLY_SURVEY.SWITCH) {
schedule.scheduleJob(config.WEEKLY_SURVEY.CRON, sendSurveys)
}
// schedule payment processing
schedule.scheduleJob(config.PAYMENT_PROCESSING.CRON, processScheduler)

schedule.scheduleJob(config.CRON_CANDIDATE_REVIEW, emailNotificationService.sendCandidatesAvailableEmails)
schedule.scheduleJob(config.CRON_INTERVIEW_COMING_UP, emailNotificationService.sendInterviewComingUpEmails)
schedule.scheduleJob(config.CRON_INTERVIEW_COMPLETED, emailNotificationService.sendInterviewCompletedEmails)
schedule.scheduleJob(config.CRON_POST_INTERVIEW, emailNotificationService.sendPostInterviewActionEmails)
schedule.scheduleJob(config.CRON_UPCOMING_RESOURCE_BOOKING, emailNotificationService.sendResourceBookingExpirationEmails)
schedule.scheduleJob(config.CRON_CANDIDATE_REVIEW, notificationSchedulerService.sendCandidatesAvailableNotifications)
schedule.scheduleJob(config.CRON_INTERVIEW_COMING_UP, notificationSchedulerService.sendInterviewComingUpNotifications)
schedule.scheduleJob(config.CRON_INTERVIEW_COMPLETED, notificationSchedulerService.sendInterviewCompletedNotifications)
schedule.scheduleJob(config.CRON_POST_INTERVIEW, notificationSchedulerService.sendPostInterviewActionNotifications)
schedule.scheduleJob(config.CRON_UPCOMING_RESOURCE_BOOKING, notificationSchedulerService.sendResourceBookingExpirationNotifications)
})

if (process.env.NODE_ENV === 'test') {
Expand Down
17 changes: 14 additions & 3 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ module.exports = {

// the Topcoder v5 url
TC_API: process.env.TC_API || 'https://api.topcoder-dev.com/v5',
// the Topcoder Beta API url currently v5.1
TC_BETA_API: process.env.TC_BETA_API || 'https://api.topcoder-dev.com/v5.1',
// the organization id
ORG_ID: process.env.ORG_ID || '36ed815b-3da1-49f1-a043-aaed0a4e81ad',
// the referenced skill provider id
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',
// the referenced taxonomy id
TOPCODER_TAXONOMY_ID: process.env.TOPCODER_TAXONOMY_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',

TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',
// the api to find topcoder members
Expand Down Expand Up @@ -142,6 +144,8 @@ module.exports = {
TAAS_ROLE_UPDATE_TOPIC: process.env.TAAS_ROLE_UPDATE_TOPIC || 'taas.role.update',
// the delete role entity Kafka message topic
TAAS_ROLE_DELETE_TOPIC: process.env.TAAS_ROLE_DELETE_TOPIC || 'taas.role.delete',
// the create team entity message topic, only used for eventHandler
TAAS_TEAM_CREATE_TOPIC: process.env.TAAS_TEAM_CREATE_TOPIC || 'taas.team.create',
// special kafka topics
TAAS_ACTION_RETRY_TOPIC: process.env.TAAS_ACTION_RETRY_TOPIC || 'taas.action.retry',

Expand All @@ -161,6 +165,10 @@ module.exports = {
// INTERVIEW_INVITATION_RECIPIENTS_LIST may contain comma-separated list of email which is converted to array
// [email protected] should be in the RECIPIENTS list
INTERVIEW_INVITATION_RECIPIENTS_LIST: (process.env.INTERVIEW_INVITATION_RECIPIENTS_LIST || '[email protected]').split(','),
// the emails address for overlapping interview
NOTIFICATION_OPS_EMAILS: (process.env.NOTIFICATION_OPS_EMAILS || '[email protected]').split(','),
// the slack channel for sending notifications
NOTIFICATION_SLACK_CHANNEL: process.env.NOTIFICATION_SLACK_CHANNEL || '#tass-notification',
// 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
Expand All @@ -184,6 +192,7 @@ module.exports = {
TOPCODER_SKILLS_CACHE_TIME: process.env.TOPCODER_SKILLS_CACHE_TIME || 60,
// weekly survey scheduler config
WEEKLY_SURVEY: {
SWITCH: process.env.WEEKLY_SURVEY_SWITCH || 'OFF',
CRON: process.env.WEEKLY_SURVEY_CRON || '0 1 * * 7',
BASE_URL: process.env.WEEKLY_SURVEY_BASE_URL || 'https://api.surveymonkey.net/v3/surveys',
JWT_TOKEN: process.env.WEEKLY_SURVEY_JWT_TOKEN || '',
Expand Down Expand Up @@ -268,5 +277,7 @@ module.exports = {
RESOURCE_BOOKING_EXPIRY_TIME: process.env.RESOURCE_BOOKING_EXPIRY_TIME || 'P21D',
// The Stripe
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
CURRENCY: process.env.CURRENCY || 'usd'
CURRENCY: process.env.CURRENCY || 'usd',
// RCRM base URL
RCRM_APP_URL: process.env.RCRM_APP_URL || 'https://app.recruitcrm.io'
}
42 changes: 42 additions & 0 deletions config/email_template.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ module.exports = {
* List all kind of emails which could be send as Email Notifications by scheduler, API endpoints or anything else.
*/
notificationEmailTemplates: {
'taas.notification.job-candidate-resume-viewed': {
subject: 'Topcoder - Client View Resume for Job {{jobName}}',
body: '',
recipients: [],
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
},
'taas.notification.candidates-available-for-review': {
subject: 'Topcoder - {{teamName}} has job candidates available for review',
body: '',
Expand Down Expand Up @@ -152,6 +159,41 @@ module.exports = {
recipients: [],
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
},
'taas.notification.team-created': {
subject: 'Topcoder - New Team {{teamName}} Created',
body: '',
recipients: [],
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
},
'taas.notification.job-created': {
subject: 'Topcoder - New Job {{jobTitle}} Created in Team {{teamName}}',
body: '',
recipients: [],
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
},
'taas.notification.interviews-overlapping': {
subject: 'Topcoder - Interviews overlapping',
body: '',
recipients: config.NOTIFICATION_OPS_EMAILS,
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
},
'taas.notification.job-candidate-selected': {
subject: 'Topcoder - Job Candidate {{userHandle}} Selected for {{jobTitle}} in Team {{teamName}}',
body: '',
recipients: config.NOTIFICATION_OPS_EMAILS,
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
},
'taas.notification.resource-booking-placed': {
subject: 'Topcoder - Resource Booking {{userHandle}} Placed for Job {{jobTitle}} in Team {{teamName}}',
body: '',
recipients: [],
from: config.NOTIFICATION_SENDER_EMAIL,
sendgridTemplateId: config.NOTIFICATION_SENDGRID_TEMPLATE_ID
}
}
}
Loading

0 comments on commit 5ca8b61

Please sign in to comment.