Skip to content

Commit 12ba53a

Browse files
author
sachin-maheshwari
authored
Merge pull request #495 from yoution/feature/shapeup4-cqrs-update
Feature/shapeup4 cqrs update
2 parents 20586db + abba8ff commit 12ba53a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3440
-318
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ build/Release
4040
# Dependency directories
4141
node_modules/
4242
jspm_packages/
43+
scripts/withdrawn-migration/temp/
4344

4445
# Snowpack dependency directory (https://snowpack.dev/)
4546
web_modules/

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
ES_HOST=http://dockerhost:9200
4848
DATABASE_URL=postgres://postgres:postgres@dockerhost:5432/postgres
4949
BUSAPI_URL=http://dockerhost:8002/v5
50+
# stripe
51+
STRIPE_SECRET_KEY=
52+
CURRENCY=usd
5053
```
5154

5255
- Values from this file would be automatically used by many `npm` commands.
@@ -215,6 +218,7 @@ To be able to change and test `taas-es-processor` locally you can follow the nex
215218
| `npm run services:up` | Start services via docker-compose for local development. |
216219
| `npm run services:down` | Stop services via docker-compose for local development. |
217220
| `npm run services:logs -- -f <service_name>` | View logs of some service inside docker-compose. |
221+
| `npm run services:rebuild -- -f <service_name>` | Rebuild service container ignoring cache (useful when pushed something to the Git repository of service) |
218222
| `npm run local:init` | Recreate Database and Elasticsearch indexes and populate demo data for local development (removes any existent data). |
219223
| `npm run local:reset` | Recreate Database and Elasticsearch indexes (removes any existent data). |
220224
| `npm run cov` | Code Coverage Report. |
@@ -337,6 +341,6 @@ When we add, update or delete models and/or endpoints we have to make sure that
337341
- Test, that when we migrate DB from the previous state using `npm run migrate`, we get exactly the same DB schema as if we create DB from scratch using command `npm run init-db force`.
338342
339343
## EMSI mapping
340-
mapping EMSI tags to topcoder skills
341-
Run `npm run emsi-mapping` to create the mapping file
344+
mapping EMSI tags to topcoder skills
345+
Run `npm run emsi-mapping` to create the mapping file
342346
It will take about 15 minutes to create the mapping file `script/emsi-mapping/emsi-skils-mapping.js`

app-constants.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ const PaymentSchedulerStatus = {
152152
CLOSE_CHALLENGE: 'close-challenge'
153153
}
154154

155+
const JobStatus = {
156+
OPEN: 'open'
157+
}
158+
159+
const JobCandidateStatus = {
160+
INTERVIEW: 'interview'
161+
}
162+
155163
module.exports = {
156164
UserRoles,
157165
FullManagePermissionRoles,
@@ -164,5 +172,7 @@ module.exports = {
164172
PaymentSchedulerStatus,
165173
PaymentProcessingSwitch,
166174
PaymentStatusRules,
167-
ActiveWorkPeriodPaymentStatuses
175+
ActiveWorkPeriodPaymentStatuses,
176+
JobStatus,
177+
JobCandidateStatus
168178
}

app.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const logger = require('./src/common/logger')
1414
const eventHandlers = require('./src/eventHandlers')
1515
const interviewService = require('./src/services/InterviewService')
1616
const { processScheduler } = require('./src/services/PaymentSchedulerService')
17+
const { sendSurveys } = require('./src/services/SurveyService')
18+
const emailNotificationService = require('./src/services/EmailNotificationService')
1719

1820
// setup express app
1921
const app = express()
@@ -98,9 +100,16 @@ const server = app.listen(app.get('port'), () => {
98100
eventHandlers.init()
99101
// schedule updateCompletedInterviews to run every hour
100102
schedule.scheduleJob('0 0 * * * *', interviewService.updateCompletedInterviews)
101-
103+
// schedule sendSurveys
104+
schedule.scheduleJob(config.WEEKLY_SURVEY.CRON, sendSurveys)
102105
// schedule payment processing
103106
schedule.scheduleJob(config.PAYMENT_PROCESSING.CRON, processScheduler)
107+
108+
schedule.scheduleJob(config.CRON_CANDIDATE_REVIEW, emailNotificationService.sendCandidatesAvailableEmails)
109+
schedule.scheduleJob(config.CRON_INTERVIEW_COMING_UP, emailNotificationService.sendInterviewComingUpEmails)
110+
schedule.scheduleJob(config.CRON_INTERVIEW_COMPLETED, emailNotificationService.sendInterviewCompletedEmails)
111+
schedule.scheduleJob(config.CRON_POST_INTERVIEW, emailNotificationService.sendPostInterviewActionEmails)
112+
schedule.scheduleJob(config.CRON_UPCOMING_RESOURCE_BOOKING, emailNotificationService.sendResourceBookingExpirationEmails)
104113
})
105114

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

config/default.js

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ module.exports = {
150150

151151
// the Kafka message topic for sending email
152152
EMAIL_TOPIC: process.env.EMAIL_TOPIC || 'external.action.email',
153+
// the Kafka message topic for creating notifications
154+
NOTIFICATIONS_CREATE_TOPIC: process.env.NOTIFICATIONS_CREATE_TOPIC || 'notifications.action.create',
153155
// the emails address for receiving the issue report
154156
// REPORT_ISSUE_EMAILS may contain comma-separated list of email which is converted to array
155157
REPORT_ISSUE_EMAILS: (process.env.REPORT_ISSUE_EMAILS || '').split(','),
@@ -178,11 +180,22 @@ module.exports = {
178180
DEFAULT_TIMELINE_TEMPLATE_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '53a307ce-b4b3-4d6f-b9a1-3741a58f77e6',
179181
DEFAULT_TRACK_ID: process.env.DEFAULT_TRACK_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825',
180182
// the minimum matching rate when searching roles by skills
181-
ROLE_MATCHING_RATE: process.env.ROLE_MATCHING_RATE || 0.70,
183+
ROLE_MATCHING_RATE: process.env.ROLE_MATCHING_RATE || 0.66,
182184
// member groups representing Wipro or TopCoder employee
183185
INTERNAL_MEMBER_GROUPS: process.env.INTERNAL_MEMBER_GROUPS || ['20000000', '20000001', '20000003', '20000010', '20000015'],
184186
// Topcoder skills cache time in minutes
185187
TOPCODER_SKILLS_CACHE_TIME: process.env.TOPCODER_SKILLS_CACHE_TIME || 60,
188+
// weekly survey scheduler config
189+
WEEKLY_SURVEY: {
190+
CRON: process.env.WEEKLY_SURVEY_CRON || '0 1 * * 7',
191+
BASE_URL: process.env.WEEKLY_SURVEY_BASE_URL || 'https://api.surveymonkey.net/v3/surveys',
192+
JWT_TOKEN: process.env.WEEKLY_SURVEY_JWT_TOKEN || '',
193+
SURVEY_ID: process.env.WEEKLY_SURVEY_SURVEY_ID || '',
194+
SURVEY_COLLECTOR_PREFIX: process.env.WEEKLY_SURVEY_SURVEY_COLLECTOR_PREFIX || 'Week ending',
195+
SURVEY_MASTER_COLLECTOR_ID: process.env.WEEKLY_SURVEY_SURVEY_MASTER_COLLECTOR_ID || '',
196+
SURVEY_MASTER_MESSAGE_ID: process.env.WEEKLY_SURVEY_SURVEY_MASTER_MESSAGE_ID || '',
197+
SURVEY_CONTACT_GROUP_ID: process.env.WEEKLY_SURVEY_SURVEY_CONTACT_GROUP_ID || ''
198+
},
186199
// payment scheduler config
187200
PAYMENT_PROCESSING: {
188201
// switch off actual API calls in Payment Scheduler
@@ -229,5 +242,34 @@ module.exports = {
229242
interview: 'withdrawn',
230243
selected: 'withdrawn',
231244
offered: 'withdrawn'
232-
}
245+
},
246+
// the sender email
247+
NOTIFICATION_SENDER_EMAIL: process.env.NOTIFICATION_SENDER_EMAIL,
248+
// the email notification sendgrid template id
249+
NOTIFICATION_SENDGRID_TEMPLATE_ID: process.env.NOTIFICATION_SENDGRID_TEMPLATE_ID,
250+
// frequency of cron checking for available candidates for review
251+
CRON_CANDIDATE_REVIEW: process.env.CRON_CANDIDATE_REVIEW || '00 00 13 * * 0-6',
252+
// frequency of cron checking for coming up interviews
253+
// when changing this to frequency other than 5 mins, please change the minutesRange in sendInterviewComingUpEmails correspondingly
254+
CRON_INTERVIEW_COMING_UP: process.env.CRON_INTERVIEW_COMING_UP || '*/5 * * * *',
255+
// frequency of cron checking for interview completed
256+
// when changing this to frequency other than 5 mins, please change the minutesRange in sendInterviewCompletedEmails correspondingly
257+
CRON_INTERVIEW_COMPLETED: process.env.CRON_INTERVIEW_COMPLETED || '*/5 * * * *',
258+
// frequency of cron checking for post interview actions
259+
CRON_POST_INTERVIEW: process.env.CRON_POST_INTERVIEW || '00 00 13 * * 0-6',
260+
// frequency of cron checking for upcoming resource bookings
261+
CRON_UPCOMING_RESOURCE_BOOKING: process.env.CRON_UPCOMING_RESOURCE_BOOKING || '00 00 13 * * 1',
262+
// The match window for fetching interviews which are coming up
263+
INTERVIEW_COMING_UP_MATCH_WINDOW: process.env.INTERVIEW_COMING_UP_MATCH_WINDOW || 'PT5M',
264+
// The remind time for fetching interviews which are coming up
265+
INTERVIEW_COMING_UP_REMIND_TIME: (process.env.INTERVIEW_COMING_UP_REMIND_TIME || 'PT1H,PT24H').split(','),
266+
// The match window for fetching completed interviews
267+
INTERVIEW_COMPLETED_MATCH_WINDOW: process.env.INTERVIEW_COMPLETED_MATCH_WINDOW || 'PT5M',
268+
// The interview completed past time for fetching interviews
269+
INTERVIEW_COMPLETED_PAST_TIME: process.env.INTERVIEW_COMPLETED_PAST_TIME || 'PT4H',
270+
// The time before resource booking expiry when we should start sending notifications
271+
RESOURCE_BOOKING_EXPIRY_TIME: process.env.RESOURCE_BOOKING_EXPIRY_TIME || 'P21D',
272+
// The Stripe
273+
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
274+
CURRENCY: process.env.CURRENCY || 'usd'
233275
}

0 commit comments

Comments
 (0)