Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
946717a
Revert "Revert splitting email templates"
maxceem Sep 2, 2021
0a51662
update RB expiring email subject and text
maxceem Sep 8, 2021
1ee86ce
Merge branch 'dev' into revert-532-feature/revert-splitting-email-tem…
maxceem Sep 9, 2021
bcbc2f8
Merge branch 'dev' into revert-532-feature/revert-splitting-email-tem…
maxceem Sep 17, 2021
8ee9fa0
fix merging issue
maxceem Sep 17, 2021
318346e
Initial commit, again
deblasis Sep 30, 2021
6048ee2
Makefile
deblasis Sep 30, 2021
ff4aad6
Makefile
deblasis Sep 30, 2021
a8a723c
Makefile
deblasis Sep 30, 2021
426e0c3
Makefile
deblasis Sep 30, 2021
f9f689e
Makefile
deblasis Sep 30, 2021
0d9fae8
Makefile
deblasis Sep 30, 2021
4583777
Makefile
deblasis Sep 30, 2021
cbc8b1b
Makefile
deblasis Sep 30, 2021
c15c4e7
Makefile
deblasis Sep 30, 2021
00cd86c
Makefile
deblasis Sep 30, 2021
89df26b
gitignore
deblasis Sep 30, 2021
9fa4cd6
Create Interview Endpoint (#12)
deblasis Oct 1, 2021
086f2c1
Merge branch 'feature/interview-nylas' of github.com:deblasis/topcode…
deblasis Oct 1, 2021
9e4813f
Update Interview Endpoints (#13)
deblasis Oct 1, 2021
5867e0e
Get Interview Endpoints (#15)
deblasis Oct 1, 2021
375b0a8
Get User Meeting Settings Endpoint (#16)
deblasis Oct 1, 2021
6c79e52
unit tests must pass (#17)
deblasis Oct 1, 2021
44d1c8b
GENERAL REQUIREMENTS (#18)
deblasis Oct 2, 2021
908b703
package-lock v2
deblasis Oct 2, 2021
7b9f865
Merge commit 'a0d5740ec8a7722e1d4b050572878e1ac99716a3' into feature/…
deblasis Oct 2, 2021
9871786
fix
deblasis Oct 4, 2021
cfdb243
trailing space
deblasis Oct 4, 2021
86f49e0
trailing space
deblasis Oct 4, 2021
a34d4aa
trailing space
deblasis Oct 4, 2021
1108c84
trailing space
deblasis Oct 4, 2021
3418de4
fixes
deblasis Oct 4, 2021
ac2955e
Merge branch 'dev' into revert-532-feature/revert-splitting-email-tem…
maxceem Oct 5, 2021
bd6cb4e
Merge pull request #565 from deblasis/feature/interview-nylas
maxceem Oct 9, 2021
298c062
Merge branch 'revert-532-feature/revert-splitting-email-templates' in…
maxceem Oct 9, 2021
2a730fe
fix typo
maxceem Oct 9, 2021
b32ecb8
Listen Nylas webhook to update interview status, add some email notif…
painterner Oct 13, 2021
b07c79a
Nylas Webhook security fixed, email template format modified
painterner Oct 13, 2021
7dd6617
Implemented Nylas calendar connect, delete functionalities.
alvimmh Oct 13, 2021
7be41b2
migrate inteview status
painterner Oct 13, 2021
9b9f36f
reminder should reference to createdAt, update interview status synce…
painterner Oct 15, 2021
5889f92
fixed interview status migration script
painterner Oct 17, 2021
10f64ca
added error capture for NotificationsSchedulerService
painterner Oct 17, 2021
342adeb
Added end time and start time timestamp for interview when selected time
painterner Oct 17, 2021
6c19a24
remove console debug
painterner Oct 17, 2021
80c4784
Added error catcher for other notification scheduler functions
painterner Oct 19, 2021
c003256
Changed route nylas-webhook to /taas/nylas-webhooks, only nylas webho…
painterner Oct 19, 2021
972e118
Moved sendInterviewInvitationNotifications from services/Notification…
painterner Oct 19, 2021
6c85d4d
Updated Zoom meeting creation methods in Zoom Service.
alvimmh Oct 19, 2021
e5195d5
Updated the UserMeetingSettings controller & service.
alvimmh Oct 19, 2021
91c6fa0
Updated Swagger docs for recently added endpoints.
alvimmh Oct 19, 2021
82d7ea4
Updated Postman collection & environment files for recently added end…
alvimmh Oct 19, 2021
1270c88
Moved send invitation to kafka event processer
painterner Oct 19, 2021
d33f1a1
Merge pull request #571 from painterner/feature/interview-nylas
maxceem Oct 19, 2021
37fb85d
Merge pull request #577 from mahidulalvi-bonic/feature/interview-nylas
maxceem Oct 20, 2021
5178f5e
fix lint
maxceem Oct 20, 2021
241a321
nylas page should allow only one booking
maxceem Oct 20, 2021
1246022
fix: return code 404 when cannot find calendar for deleting
maxceem Oct 20, 2021
8586889
Added better error handling when deleting UserMeetingSettings calendars.
alvimmh Oct 20, 2021
3b06e71
Merge branch 'feature/interview-nylas' into feature/interview-nylas
Oct 20, 2021
07aeb62
Fixed an error handling in UserMeetingSettingsService 'handleConnectC…
alvimmh Oct 20, 2021
4c7dfcd
Refactored UserMeetingSettings controller & service 'handleConnectCal…
alvimmh Oct 20, 2021
e43c5f9
Merge pull request #580 from mahidulalvi-bonic/feature/interview-nylas
maxceem Oct 21, 2021
b0b07a9
fix connecting first calendar without timezone
maxceem Oct 21, 2021
f1e0e1f
improve interview create time validation
maxceem Oct 21, 2021
013b57e
don't hide name on the Nylas Page
maxceem Oct 22, 2021
c120501
fix generating Zoom link in round-robin
maxceem Oct 22, 2021
8af12b8
Fixed issues relating to calendar connection & deletion in UserMeetin…
alvimmh Oct 22, 2021
2308de6
Updated NylasService & UserMeetingSettingsService methods.
alvimmh Oct 23, 2021
5c7e61e
Merge pull request #1 from mahidulalvi-bonic/feature/interview-nylas
Oct 23, 2021
8bb1680
Merge pull request #594 from mahidulalvi-bonic/feature/interview-update
maxceem Oct 24, 2021
860ac08
Updated the Nylas Calendar schema in UserMeetingSettings model.
alvimmh Oct 24, 2021
510f7a7
Merge pull request #596 from mahidulalvi-bonic/feature/interview-update
maxceem Oct 25, 2021
18cc529
refactor UserMeetingSettings creation method
maxceem Oct 25, 2021
8bb379d
debug config for VSCode
maxceem Oct 25, 2021
fb51ff6
Added error handling for expired JWT in UserMeetingSettingsService.
alvimmh Oct 26, 2021
a5f4b31
fix: issue #586
yoution Oct 26, 2021
1c7a677
Merge pull request #595 from yoution/issue-586
maxceem Oct 26, 2021
5686b36
fix git merge error
maxceem Oct 26, 2021
6b1870c
fix: only send scheduled emails if interview status changed
maxceem Oct 26, 2021
edb7585
Merge pull request #604 from mahidulalvi-bonic/feature/interview-update
maxceem Oct 26, 2021
5a6a9fb
config default nylas jwt secret
maxceem Oct 26, 2021
370073d
fix: issue #605
yoution Oct 27, 2021
6d7b68e
Merge pull request #606 from yoution/issue-605
maxceem Oct 27, 2021
266cd2a
added space after labels in email templates
maxceem Oct 27, 2021
f4f4aef
add timezone to interview confirmation emails
maxceem Oct 27, 2021
7ecd336
improve readme
maxceem Oct 28, 2021
efd94c2
don't restrict Nylas bookings as it breaks re-scheduling
maxceem Oct 28, 2021
991c389
enrich Nylas webhooks debug logging
maxceem Oct 28, 2021
c2c86e6
fix interview migration script
maxceem Oct 28, 2021
9484b85
Merge pull request #582 from topcoder-platform/feature/interview-update
maxceem Oct 28, 2021
15e1e6c
freez exact "elasticsearch" package version to be compatible with AWS
maxceem Oct 28, 2021
97970cd
fix routes prefix
maxceem Oct 28, 2021
d29a13a
fix nylas webhook route in middleware
maxceem Oct 28, 2021
85e2f3c
fix nylas webhook route
maxceem Oct 28, 2021
3596faa
create zoom account only after time confirmed
maxceem Oct 28, 2021
614c997
fix nylas webhooks path in docs
maxceem Oct 28, 2021
9a6fad5
fix creating nylas page without location
maxceem Oct 28, 2021
5f17c6f
force ES refresh when creating interview
maxceem Oct 28, 2021
c86fe31
use elasticsearch 7.8 same as on DEV
maxceem Oct 28, 2021
8d335ce
reindex created Interview together with Job Candidate
maxceem Oct 28, 2021
7f46327
debug interview and job candidate indexing
maxceem Oct 28, 2021
ea7db63
debug creating user setting during creating interview
maxceem Oct 28, 2021
ba3f5c9
support UserMeetingSettings ES inconsistency
maxceem Oct 28, 2021
624f238
interview time validation matches ES
maxceem Oct 28, 2021
c8ba488
Revert "debug interview and job candidate indexing"
maxceem Oct 28, 2021
4636255
Revert "reindex created Interview together with Job Candidate"
maxceem Oct 28, 2021
a44826d
Revert "force ES refresh when creating interview"
maxceem Oct 28, 2021
53d85ca
log error instead of debug
maxceem Oct 28, 2021
a334213
fix dates timezone in interview confirmation emails
maxceem Oct 28, 2021
9a94fbf
interview dates timezone format as string
maxceem Oct 28, 2021
b990b6d
improve connect calendar error handling
maxceem Oct 28, 2021
49e646c
Added new field 'email' in NylasCalendars column in UserMeetingSettin…
alvimmh Oct 29, 2021
971cc5f
fix Postman UserMeetingSettings urls
maxceem Oct 29, 2021
5002aeb
Merge pull request #607 from mahidulalvi-bonic/feature/interview-update
maxceem Oct 29, 2021
3c49802
allow scheduling interview 15 days in feature
maxceem Oct 29, 2021
64ada97
use only not deleted calendars when scheduling
maxceem Oct 30, 2021
31bb3c9
add "minutes" in interview emails
maxceem Oct 30, 2021
70db75f
fix updating UserMeetingsSettings
maxceem Oct 30, 2021
eac8cbd
use string timezone instead of offset in interview emails
maxceem Oct 30, 2021
218f2d1
return calendar JWT token error details
maxceem Nov 1, 2021
d575809
fix: issue topcoder-platform/taas-app#544
yoution Nov 1, 2021
d29d2a4
log nylas webhook error details
maxceem Nov 2, 2021
414dfbf
Merge pull request #611 from yoution/issue-taas
maxceem Nov 2, 2021
73a0bd3
rename interview host details fields
maxceem Nov 2, 2021
38a5d2a
fix lint
maxceem Nov 2, 2021
6236d2d
log nylas webhook error details
maxceem Nov 2, 2021
bae2411
fix interview confirmation email templates
maxceem Nov 3, 2021
f6d560a
fix interview confirmation email template small issues
maxceem Nov 3, 2021
58a975f
fix replacing connected calendar
maxceem Nov 3, 2021
e8e3f4d
fix br in templates
maxceem Nov 4, 2021
539263f
per interview Nylas webhook
maxceem Nov 5, 2021
6db5d6b
email templates fixes
maxceem Nov 5, 2021
567cd18
add comment
maxceem Nov 5, 2021
6c25130
remove start/end date from RB placed email
maxceem Nov 5, 2021
bbbca9c
Replaced method 'updateInterviewStatus' with 'partiallyUpdateIntervie…
alvimmh Nov 6, 2021
01e3f23
Merge branch 'dev' of github.com:mahidulalvi-bonic/taas-apis into dev
alvimmh Nov 6, 2021
0361b9d
Updated Joi validation rules for method 'partiallyUpdateInterviewById…
alvimmh Nov 6, 2021
75aed29
Used method 'partiallyUpdateInterviewById' from InterviewService inst…
alvimmh Nov 6, 2021
4d1cfa0
Reverted an unnecessary change in interviewProcessor.
alvimmh Nov 6, 2021
29a7cd6
Replaced Nylas webhook which listens to created events.
alvimmh Nov 7, 2021
ab80cc1
Implemented usage of metadata from event details in Nylas global webh…
alvimmh Nov 7, 2021
d5d8540
Updated Swagger docs & some Joi validation rules for Interview routes…
alvimmh Nov 7, 2021
2418faf
Added new columns 'nylas_event_id' & 'nylas_event_edit_hash' to Inter…
alvimmh Nov 8, 2021
62a40fa
Updated Swagger docs for recent changes to Interview model.
alvimmh Nov 8, 2021
d322e8c
Updated Nylas global & specific webooks to populate & utilize new Int…
alvimmh Nov 8, 2021
0d83b81
fix: issue topcoder-platform/taas-app#560
yoution Nov 8, 2021
231a967
Added Interview cancel & reschedule links in Interview detail notific…
alvimmh Nov 8, 2021
57e5cac
Updated Nylas event in the created events webhook handler endpoint.
alvimmh Nov 8, 2021
7c5fe2b
Updated Swagger docs & some Joi validation rules for Interview routes…
alvimmh Nov 7, 2021
a336c1d
Merge pull request #625 from topcoder-platform/feature/interview-upda…
maxceem Nov 8, 2021
215fb2a
Refactored interview reschedule/cancel functionality.
alvimmh Nov 8, 2021
668d278
fix sending interview confirmation email
maxceem Nov 8, 2021
5af2883
add created nylas page debuggin
maxceem Nov 8, 2021
8b89d13
fix typo
maxceem Nov 8, 2021
52e3f84
Merge branch 'dev' into issue-560
maxceem Nov 8, 2021
c37eab7
Merge pull request #624 from yoution/issue-560
maxceem Nov 8, 2021
9789b6a
Enabled authentication in Nylas created events webhook endpoint.
alvimmh Nov 9, 2021
8c416ea
Merge branch 'dev' of github.com:topcoder-platform/taas-apis into dev
maxceem Nov 9, 2021
10049e4
Merge pull request #622 from mahidulalvi-bonic/dev
maxceem Nov 9, 2021
2049b51
Implemented Interview emails to be sent in the receiver's timezone.
alvimmh Nov 9, 2021
838df04
fix: issue topcoder-platform/taas-app#570
yoution Nov 9, 2021
d8fe355
set default nylas webhook secret for local testing
maxceem Nov 10, 2021
eb2dfa0
skip processing not interesting events and remove wordy logs
maxceem Nov 10, 2021
a1debb6
fix removing non-nylas calendar
maxceem Nov 10, 2021
27eaa64
reuse existent Virtual Calendar as we can have only one
maxceem Nov 10, 2021
7f063ca
add space after "cancel" and "reschedule" links
maxceem Nov 11, 2021
c3d3db8
fix: issue #629
yoution Nov 12, 2021
ccaa7df
fix: issue #629
yoution Nov 16, 2021
cd1c336
Merge pull request #626 from yoution/issue-570
maxceem Nov 17, 2021
78f4b34
Merge pull request #630 from yoution/issue-629
maxceem Nov 17, 2021
b04c414
fix reschedule notification
maxceem Nov 17, 2021
caef842
Merge pull request #628 from mahidulalvi-bonic/dev
maxceem Nov 17, 2021
be84c64
VSCode debug config using nodemon
maxceem Nov 17, 2021
7368a7e
guest/host timezone in cancel and reschedule emails
maxceem Nov 17, 2021
2e2d67a
fix re-schedule/cancel logic
maxceem Nov 19, 2021
96b2139
Merge pull request #627 from topcoder-platform/feature/interview-upda…
Nov 22, 2021
e09a09c
improve interview local setup readmes
maxceem Nov 22, 2021
c77eb66
Merge pull request #633 from topcoder-platform/feature/interview-upda…
maxceem Nov 22, 2021
a8112eb
fix: issue #634
yoution Nov 23, 2021
a2c5a6a
improve scheduling/rescheduling logic
maxceem Nov 23, 2021
b0d4d9c
custom thank you page for interview
maxceem Nov 23, 2021
9b95cd0
Merge pull request #636 from topcoder-platform/feature/interview-upda…
maxceem Nov 23, 2021
36fbf79
Merge pull request #635 from yoution/issue-634
maxceem Nov 23, 2021
fe21a91
fix lint
maxceem Nov 24, 2021
5bbe555
fallback to host timezone in guest emails
maxceem Nov 24, 2021
8e4f459
improve interview postman
maxceem Nov 24, 2021
b780c89
retry getting Nylas calendar when connecting
maxceem Nov 25, 2021
e424044
fix issue with duplicate Nylas event for interview
maxceem Nov 26, 2021
309307e
fix issue with duplicate Nylas event for interview when updating (can…
maxceem Nov 26, 2021
a8c5445
fix permission for getting interview by JC when falling back to DB
maxceem Nov 26, 2021
9bb38f0
support delay with calendar connection
maxceem Dec 2, 2021
fe5e40c
Update the way how we generate Zoom links:
xxcxy Dec 3, 2021
568c2b1
Merge pull request #639 from xxcxy/feature/interview-zoom-links
maxceem Dec 3, 2021
8bd5ca6
fix updating interview with zoom account and id info
maxceem Dec 3, 2021
c397610
Merge branch 'feature/interview-zoom-links' into feature/nylas-webhoo…
maxceem Dec 3, 2021
8ba8788
set default value
maxceem Dec 3, 2021
1fa9690
remove existent interview when migrating to zoom
maxceem Dec 5, 2021
a2a3eda
final implementation to support delayed calendar connection
maxceem Dec 5, 2021
924b080
debug in vscode attach to process
maxceem Dec 5, 2021
7228b73
fixes to interview process and clean up
maxceem Dec 5, 2021
79bfa24
fix log
maxceem Dec 6, 2021
213946c
Merge pull request #640 from topcoder-platform/feature/interview-upda…
Dec 7, 2021
43aebcc
fix cancelling events when nylas event is deleted
maxceem Dec 7, 2021
04c039c
Merge pull request #641 from topcoder-platform/feature/interview-upda…
maxceem Dec 7, 2021
e22bf5a
fix: issue topcoder-platform/taas-app#576
yoution Dec 9, 2021
1bc7a26
fix: issue topcoder-platform/taas-app#576
yoution Dec 10, 2021
e68614d
Merge pull request #642 from yoution/issue-576
maxceem Dec 13, 2021
a67c085
update email subject for guest interview confirmed
maxceem Dec 13, 2021
66168ce
fix issue 591
xxcxy Dec 16, 2021
4e63662
fix issues 593
xxcxy Dec 16, 2021
c0799d6
Merge pull request #644 from xxcxy/fix-issues-593
maxceem Dec 16, 2021
309bb3e
Merge pull request #643 from xxcxy/fix-issues-591
maxceem Dec 16, 2021
09ec14f
trigger re-deployment
maxceem Dec 16, 2021
3ce16bd
fix issue 593 reschedule
xxcxy Dec 17, 2021
b51b5f3
Merge pull request #646 from xxcxy/fix-issues-593
maxceem Dec 19, 2021
ae8abaf
fix 593 issue
xxcxy Dec 21, 2021
d9663df
Merge pull request #649 from xxcxy/fix-issues-593
maxceem Dec 21, 2021
1eef453
fix: issue #615
yoution Dec 21, 2021
04181db
Merge pull request #650 from yoution/issue-615
maxceem Dec 23, 2021
2a6226c
fix: issue #615
yoution Dec 23, 2021
b994a61
Merge pull request #651 from yoution/issue-615
maxceem Dec 23, 2021
2bcd043
don't get default timezone from calendar for host
maxceem Dec 23, 2021
1dcf0e0
fix sendgrid email teampltes
maxceem Jan 3, 2022
eefcbbb
remove attendees from emails
maxceem Jan 4, 2022
06c8fd1
fix: issue #653
yoution Jan 4, 2022
8425fcf
Merge pull request #657 from yoution/issue-653
maxceem Jan 4, 2022
c885ac6
fix email typo
maxceem Jan 4, 2022
775f969
Merge branch 'master' into dev
LieutenantRoger Feb 3, 2022
5560c07
Merge pull request #668 from topcoder-platform/rcrm-migration-2
LieutenantRoger Feb 4, 2022
e0fb9c6
Merge pull request #669 from topcoder-platform/rcrm-migration-2
LieutenantRoger Feb 4, 2022
84384b9
Merge branch 'master' into dev
LieutenantRoger Feb 4, 2022
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
40 changes: 40 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"name": "Nodemon TaaS API",
"program": "${workspaceFolder}/app.js",
"envFile": "${workspaceFolder}/.env",
"request": "launch",
"restart": true,
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/nodemon",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Launch TaaS API",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/app.js",
"envFile": "${workspaceFolder}/.env",
"console": "integratedTerminal"
},
{
"name": "Attach to dev:debug",
"type": "node",
"request": "attach",
"restart": true,
"port": 9229
}
]
}
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
GR=\033[92m>>>
NC= <<<\033[0m
.PHONY: dump_tables
dump_tables:
@echo "${GR}make sure you checked in all your changes${NC}"
@echo "${GR}going to dev${NC}"
git checkout dev
npm run services:down
npm run services:up
npm run init-db
npm run migrate
@echo "${GR}cool, we are now migrated to dev status... moving on to our branch${NC}"
git checkout feature/interview-nylas
npm run migrate
@echo "${GR}now we are post-feature migration state, let's dump the tables${NC}"
@mkdir -p ./.comparisons/migrate
@mkdir -p ./.comparisons/init-db
@docker exec -t tc-taas-postgres pg_dump -h localhost --username=postgres -t 'bookings.interviews' --schema-only postgres > ./.comparisons/migrate/interviews.sql
@docker exec -t tc-taas-postgres pg_dump -h localhost --username=postgres -t 'bookings.job_candidates' --schema-only postgres > ./.comparisons/migrate/job_candidates.sql
@docker exec -t tc-taas-postgres pg_dump -h localhost --username=postgres -t 'bookings.user_meeting_settings' --schema-only postgres > ./.comparisons/migrate/user_meeting_settings.sql
@echo "${GR}now we revert and simply `init-db force` from the feature branch${NC}"
npm run services:down
npm run services:up
npm run init-db force
@docker exec -t tc-taas-postgres pg_dump -h localhost --username=postgres -t 'bookings.interviews' --schema-only postgres > ./.comparisons/init-db/interviews.sql
@docker exec -t tc-taas-postgres pg_dump -h localhost --username=postgres -t 'bookings.job_candidates' --schema-only postgres > ./.comparisons/init-db/job_candidates.sql
@docker exec -t tc-taas-postgres pg_dump -h localhost --username=postgres -t 'bookings.user_meeting_settings' --schema-only postgres > ./.comparisons/init-db/user_meeting_settings.sql
@echo "${GR}All done, you can now compare the files${NC}"
git diff --no-index ./.comparisons/migrate/interviews.sql ./.comparisons/init-db/interviews.sql > ./.comparisons/interviews.diff || true
git diff --no-index ./.comparisons/migrate/job_candidates.sql ./.comparisons/init-db/job_candidates.sql > ./.comparisons/job_candidates.diff || true
git diff --no-index ./.comparisons/migrate/user_meeting_settings.sql ./.comparisons/init-db/user_meeting_settings.sql > ./.comparisons/user_meeting_settings.diff || true



.PHONY: reboot
reboot:
npm run services:down
npm run services:up
npm run init-db
npm run migrate
npm run local:init || true
npm run test
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@
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=
# If you would like to test Interview Workflow then Config Nylas as per ./docs/guides/Setup-Interview-Workflow-Locally.md
NYLAS_CLIENT_ID=
NYLAS_CLIENT_SECRET=
NYLAS_SCHEDULER_WEBHOOK_BASE_URL=
# Locally deployed services (via docker-compose)
ES_HOST=http://dockerhost:9200
DATABASE_URL=postgres://postgres:postgres@dockerhost:5432/postgres
BUSAPI_URL=http://dockerhost:8002/v5
TAAS_API_BASE_URL=http://localhost:3000/api/v5
# stripe
STRIPE_SECRET_KEY=
CURRENCY=usd
Expand All @@ -55,7 +57,7 @@
- Values from this file would be automatically used by many `npm` commands.
- ⚠️ Never commit this file or its copy to the repository!

1. Set `dockerhost` to point the IP address of Docker. Docker IP address depends on your system. For example if docker is run on IP `127.0.0.1` add a the next line to your `/etc/hosts` file:
2. Set `dockerhost` to point the IP address of Docker. Docker IP address depends on your system. For example if docker is run on IP `127.0.0.1` add a the next line to your `/etc/hosts` file:

```
127.0.0.1 dockerhost
Expand Down Expand Up @@ -170,6 +172,8 @@
Runs the Topcoder TaaS API using nodemon, so it would be restarted after any of the files is updated.
The Topcoder TaaS API will be served on `http://localhost:3000`.

- 💡 If you would like to test Interview Workflow locally, then follow the guide [How to Setup Interview Workflow Locally](./docs/guides/Setup-Interview-Workflow-Locally.md).

### Working on `taas-es-processor` locally

When you run `taas-apis` locally as per "[Steps to run locally](#steps-to-run-locally)" the [taas-es-processor](https://github.com/topcoder-platform/taas-es-processor) would be run for you automatically together with other services inside the docker container via `npm run services:up`.
Expand Down Expand Up @@ -224,7 +228,7 @@ To be able to change and test `taas-es-processor` locally you can follow the nex
| `npm run cov` | Code Coverage Report. |
| `npm run migrate` | Run any migration files which haven't run yet. |
| `npm run migrate:undo` | Revert most recent migration. |
| `npm run demo-payment-scheduler` | Create 1000 Work Periods Payment records in with status "scheduled" and various "amount" |
| `npm run demo-email-notifications` | Listen to the Kafka events of email notification and render all the emails into `./out` folder. See [its readme](scripts/demo-email-notifications/README.md) for details. |
| `npm run emsi-mapping` | mapping EMSI tags to topcoder skills |

## Import and Export data
Expand Down Expand Up @@ -294,6 +298,29 @@ docker exec -it tc-taas-kafka /opt/kafka/bin/kafka-console-producer.sh --broker-

- Enter or copy/paste the message into the console after starting this command.

## Email Notifications

We have various email notifications. For example many emails are sent to support Interview Scheduling Workflow. All email templates are placed inside the [.data/notification-email-templates](./data/notification-email-templates/) folder.

### Add a new Email Notification

To add a new email notification:

0. Each email notification need to have a unique topic identifier of the shape `taas.notification.{notification-type}`. Where `{notification-type}` is unique for each email notification type.
1. Create a new HTML template inside folder [.data/notification-email-templates](./data/notification-email-templates/). (You may duplicate any existent template to reuse existent styles.). Name it the same as topic: `taas.notification.{notification-type}.html`.
2. Create a corresponding config in file [./config/email_template.config.js](./config/email_template.config.js), section `notificationEmailTemplates`.
3. Name environment variable the same as topic, but **uppercase** and replace all special symbols to `_` and add suffix `_SENDGRID_TEMPLATE_ID`:
- For example topic `taas.notification.job-candidate-resume-viewed` would have corresponding environment variable
`TAAS_NOTIFICATION_JOB_CANDIDATE_RESUME_VIEWED_SENDGRID_TEMPLATE_ID`.
4. When deploying to DEV/PROD someone would have to create a new Sendgird template and fill inside Sendgrid UI subject and email HTML template by copy/pasting HTML file from the repo. And then set environment variable with the value of template if provided by Sendgrid.

### Test/Render Email Notifications Locally

To test and render email notification locally run a special script `npm run demo-email-notifications`. Before running it, follow it's [README](./scripts/demo-email-notifications/README.md) as you would have to set some additional environment variables first (add them into `.env` file).

- This script first would update demo data to create some situations to trigger notifications.
- And it would listen to Kafka events and render email notification into `./out` folder.

## DB Migration

- `npm run migrate`: run any migration files which haven't run yet.
Expand All @@ -303,10 +330,7 @@ Configuration for migration is at `./config/config.json`.

The following parameters can be set in the config file or via env variables:

- `username`: set via env `DB_USERNAME`; datebase username
- `password`: set via env `DB_PASSWORD`; datebase password
- `database`: set via env `DB_NAME`; datebase name
- `host`: set via env `DB_HOST`; datebase host name
- `url`: set via env `DATABASE_URL`; datebase url

## Testing

Expand Down Expand Up @@ -341,6 +365,7 @@ When we add, update or delete models and/or endpoints we have to make sure that
- 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`.

## EMSI mapping

mapping EMSI tags to topcoder skills
Run `npm run emsi-mapping` to create the mapping file
It will take about 15 minutes to create the mapping file `script/emsi-mapping/emsi-skils-mapping.js`
51 changes: 42 additions & 9 deletions app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ const Scopes = {
CREATE_ROLE: 'create:taas-roles',
UPDATE_ROLE: 'update:taas-roles',
DELETE_ROLE: 'delete:taas-roles',
ALL_ROLE: 'all:taas-roles'
ALL_ROLE: 'all:taas-roles',
// userMeetingSettings
READ_USER_MEETING_SETTINGS: 'read:taas-userMeetingsSettings',
CREATE_USER_MEETING_SETTINGS: 'create:taas-userMeetingsSettings',
UPDATE_USER_MEETING_SETTINGS: 'update:taas-userMeetingsSettings',
ALL_USER_MEETING_SETTINGS: 'all:taas-userMeetingsSettings'

}

// Interview related constants
Expand All @@ -69,14 +75,22 @@ const Interviews = {
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
Cancelled: 'Cancelled',
Expired: 'Expired'
},
MaxAllowedCount: 3
MaxAllowedCount: 3,
Nylas: {
Days: {
Monday: 'M',
Tuesday: 'T',
Wednesday: 'W',
Thursday: 'R',
Friday: 'F',
Saturday: 'S',
Sunday: 'U'
},
StartEndRegex: /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/
}
}

const ChallengeStatus = {
Expand Down Expand Up @@ -166,7 +180,23 @@ const JobCandidateStatus = {
INTERVIEW: 'interview'
}

const SearchUsers = {
SEARCH_USERS_PAGE_SIZE: 5
}

// provider which we have to enforce for Nylas Virtual Calendars
const NylasVirtualCalendarProvider = 'nylas'

const ZoomLinkType = {
HOST: 'host',
GUEST: 'guest'
}

// how long to wait for the Interview Webhook Mutes to release (ms)
const InterviewEventHandlerTimeout = 60 * 1000 // 60 seconds

module.exports = {
InterviewEventHandlerTimeout,
UserRoles,
FullManagePermissionRoles,
Scopes,
Expand All @@ -181,5 +211,8 @@ module.exports = {
WeeklySurveySwitch,
ActiveWorkPeriodPaymentStatuses,
JobStatus,
JobCandidateStatus
JobCandidateStatus,
SearchUsers,
NylasVirtualCalendarProvider,
ZoomLinkType
}
32 changes: 30 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,32 @@ app.use(cors({
// Allow browsers access pagination data in headers
exposedHeaders: ['X-Page', 'X-Per-Page', 'X-Total', 'X-Total-Pages', 'X-Prev-Page', 'X-Next-Page']
}))
app.use(express.json())
app.use((...args) => {
const [req, res, next] = args
// For test nylas webhook, we need raw buffer
// Here i sCustom Middleware to compute rawBody. Unfortunately using
// JSON.stringify(req.body) will remove spaces and newlines, so verification
// will fail. We must add this middleware to ensure we're computing the correct
// signature
if (req.path.match(/\/taas-teams\/nylas-webhooks/i)) {
req.rawBody = ''
req.on('data', (chunk) => (req.rawBody += chunk))
req.on('error', () => res.status(500).send('Error parsing body'))

req.on('end', () => {
// because the stream has been consumed, other parsers like bodyParser.json
// cannot stream the request data and will time out so we must explicitly parse the body
try {
req.body = req.rawBody.length ? JSON.parse(req.rawBody) : {}
next()
} catch (err) {
res.status(500).send('Error parsing body')
}
})
return
}
return express.json()(...args)
})
app.use(express.urlencoded({ extended: true }))
app.set('port', config.PORT)

Expand Down Expand Up @@ -100,7 +125,7 @@ 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)
schedule.scheduleJob(config.CRON_UPDATE_COMPLETED_INTERVIEWS, interviewService.updateCompletedInterviews)
// schedule sendSurveys
if (WeeklySurveySwitch.ON === config.WEEKLY_SURVEY.SWITCH) {
schedule.scheduleJob(config.WEEKLY_SURVEY.CRON, sendSurveys)
Expand All @@ -113,6 +138,9 @@ const server = app.listen(app.get('port'), () => {
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)

schedule.scheduleJob(config.CRON_INTERVIEW_EXPIRED, notificationSchedulerService.sendInterviewExpiredNotifications)
schedule.scheduleJob(config.CRON_INTERVIEW_SCHEDULE_REMINDER, notificationSchedulerService.sendInterviewScheduleReminderNotifications)
})

if (process.env.NODE_ENV === 'test') {
Expand Down
18 changes: 3 additions & 15 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,12 @@

module.exports = {
development: {
username: process.env.DB_USERNAME || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
database: process.env.DB_NAME || 'postgres',
host: process.env.DB_HOST || '127.0.0.1',
dialect: 'postgres'
url: process.env.DATABASE_URL || 'postgres://postgres:postgres@localhost:5432/postgres'
},
test: {
username: process.env.DB_USERNAME || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
database: process.env.DB_NAME || 'postgres',
host: process.env.DB_HOST || '127.0.0.1',
dialect: 'postgres'
url: process.env.DATABASE_URL || 'postgres://postgres:postgres@localhost:5432/postgres'
},
production: {
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: 'postgres'
url: process.env.DATABASE_URL
}
}
Loading