Skip to content

[PROD] Next Release #272

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 162 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
f314657
Get Resource Bookings together with Work Periods
eisbilir May 10, 2021
d527cdc
Merge pull request #248 from eisbilir/feature/rb-with-wp
maxceem May 17, 2021
c0fca43
chore: use postgresql version as on PROD
maxceem May 17, 2021
44aa781
Merge branch 'dev' into feature/rb-with-wp
maxceem May 17, 2021
c63d47e
Merge pull request #253 from topcoder-platform/feature/rb-with-wp
nkumar-topcoder May 17, 2021
32101cc
fix: not able to get RB without WB
eisbilir May 18, 2021
9c2ba24
Merge pull request #256 from eisbilir/dev
nkumar-topcoder May 19, 2021
4de085d
BA is to string [skip ci]
nkumar-topcoder May 19, 2021
6a894b7
BA number to string
nkumar-topcoder May 19, 2021
7783aa3
Adding statuses
sushilshinde May 21, 2021
dc1cfa4
Add JobIds to /jobs endpoint:30185451
May 22, 2021
8b55765
fix: checking if member of project
eisbilir May 22, 2021
ba0af40
fix: return pagination headers when fallback to DB
maxceem May 22, 2021
479b790
fix: filter WorkPeriods in RB endpoint
maxceem May 22, 2021
cb73c99
chore: force fallback to DB in RB requests
maxceem May 23, 2021
5790aba
fix: perPage from DB
maxceem May 23, 2021
39527ad
fix: "total" value and DB pagination
maxceem May 23, 2021
232329c
Merge pull request #263 from topcoder-platform/statuses-change
sushilshinde May 24, 2021
3a2a3d3
Created new route for creating a team/project
mbaghel May 24, 2021
95d7488
Merge pull request #265 from mbaghel/feature/role-intake
nikolay83 May 25, 2021
1ced875
resolving conflicts with dev branch
mbaghel May 25, 2021
de72b27
Merge pull request #267 from mbaghel/feature/role-intake
nikolay83 May 25, 2021
de67dbe
Merge pull request #266 from topcoder-platform/feature/role-intake
urwithat May 26, 2021
f5ae061
Merge branch 'dev' into feature/add-jobIds
maxceem May 26, 2021
1320187
Merge pull request #261 from eisbilir/dev
maxceem May 27, 2021
edbff4e
Merge pull request #264 from topcoder-platform/feature/add-jobIds
sushilshinde May 27, 2021
b16a6fc
chore: use v5/members instead of v3/members
maxceem May 27, 2021
a7d3d17
Merge pull request #271 from topcoder-platform/feature/use-v5-members
nkumar-topcoder May 27, 2021
3ede43e
fix: addded new 'offred' status
sushilshinde May 27, 2021
1616543
Merge pull request #273 from topcoder-platform/statuses-change
sushilshinde May 27, 2021
93495aa
Updated Swagger for jobCandidate statuses
sushilshinde May 27, 2021
8446c87
Update swagger.yaml
sushilshinde May 27, 2021
79e7783
Merge pull request #274 from topcoder-platform/statuses-change
sushilshinde May 27, 2021
01faad4
api-updates: challnege:30186701
May 29, 2021
0304e68
feat(job-service): accept `roles` array
cagdas001 May 29, 2021
6d6f0c1
Merge pull request #275 from cagdas001/feature/role-intake
nikolay83 May 29, 2021
9732e1e
fix: resource booking search issues
eisbilir May 30, 2021
83b994c
role endpoint added
eisbilir May 31, 2021
56484f5
Merge branch dev into feature/roles-backend-repost
eisbilir May 31, 2021
4d78351
Delete taas-apis.patch
eisbilir May 31, 2021
9dd817c
Merge pull request #279 from eisbilir/feature/roles-backend-repost
nikolay83 May 31, 2021
4f0cb9e
resolve conflicts
eisbilir May 31, 2021
28270ac
fix: added allowNull: true for new cols
sushilshinde Jun 1, 2021
be5eee5
Merge branch 'dev' into feature/api-updates
sushilshinde Jun 1, 2021
43c3d34
Merge pull request #284 from topcoder-platform/feature/api-updates
sushilshinde Jun 1, 2021
99c35db
fix: fixed syntax
sushilshinde Jun 1, 2021
ee06d4e
Merge pull request #285 from topcoder-platform/feature/api-updates
sushilshinde Jun 1, 2021
d1ac310
fix: fixed syntax comma
sushilshinde Jun 1, 2021
42c2ac3
Role & Skills Intake - Job Description Module
yoution Jun 1, 2021
727d09e
Changed the endpoint roles to taas-roles
urwithat Jun 1, 2021
f1ea6f8
Merge pull request #278 from eisbilir/dev
maxceem Jun 1, 2021
9d81849
Merge pull request #286 from yoution/feature/role-jd
nikolay83 Jun 1, 2021
b900cd4
fix: resolve conflicts
cagdas001 Jun 1, 2021
b880eaa
Merge pull request #289 from cagdas001/feature/role-intake
urwithat Jun 2, 2021
59c6e41
Merge pull request #280 from topcoder-platform/feature/role-intake
urwithat Jun 2, 2021
0876aea
Merge branch 'dev' into feature/role-jd
urwithat Jun 2, 2021
38c8d33
Merge pull request #287 from topcoder-platform/feature/role-jd
urwithat Jun 2, 2021
71ae9ab
Payments - Batch Endpoints
xxcxy Jun 2, 2021
7e5a541
Merge pull request #294 from xxcxy/feature/batch-payments
maxceem Jun 2, 2021
67c82a7
Batch Payments - Part 1 - Scheduler
xxcxy Jun 2, 2021
803f956
Merge branch 'dev' into feature/batch-payments
xxcxy Jun 2, 2021
59f2858
Merge pull request #297 from xxcxy/feature/batch-payments
maxceem Jun 2, 2021
86fe56f
fix: RB search case insensitive
eisbilir Jun 2, 2021
4cfd154
Merge pull request #298 from eisbilir/fix/rb-search-issue-01
maxceem Jun 2, 2021
39bd1c0
fix: unable to search and create
eisbilir Jun 2, 2021
382d708
fix: resolve postman conflict
yoution Jun 2, 2021
cd06046
Merge pull request #300 from yoution/feature/role-matching-backend
nikolay83 Jun 3, 2021
1022313
Merge pull request #301 from topcoder-platform/feature/role-matching-…
nikolay83 Jun 3, 2021
431157e
Merge pull request #299 from eisbilir/fix/role-issues-01
nikolay83 Jun 3, 2021
c0fe79f
Merge branch 'dev' into feature/batch-payments
maxceem Jun 3, 2021
75e915c
Merge branch 'feature/batch-payments' of github.com:topcoder-platform…
maxceem Jun 3, 2021
925d7bd
Merge pull request #295 from topcoder-platform/feature/batch-payments
nkumar-topcoder Jun 3, 2021
ac7f0e4
add new topic: action.retry
eisbilir Jun 3, 2021
81772c0
fix: unit tests
eisbilir Jun 3, 2021
15a00f4
fix some review issues
xxcxy Jun 5, 2021
a674ef9
Merge branch 'dev' of https://github.com/topcoder-platform/taas-apis …
xxcxy Jun 5, 2021
abf3e6d
role search and make team
eisbilir Jun 5, 2021
57cb38a
Merge pull request #309 from eisbilir/role-matching-backend
nikolay83 Jun 6, 2021
49926fe
Merge branch 'dev' into role-matching-backend2
eisbilir Jun 6, 2021
533b68f
Merge pull request #312 from eisbilir/role-matching-backend
nikolay83 Jun 6, 2021
e76d67f
Merge pull request #311 from topcoder-platform/role-matching-backend2
nikolay83 Jun 7, 2021
71f53c7
adjust jobIds issue
Jun 7, 2021
f63256b
Merge pull request #308 from xxcxy/feature/payment-scheduler
maxceem Jun 8, 2021
cea46cf
Merge branch 'dev' into feature/payment-scheduler
maxceem Jun 8, 2021
98d9b05
fix: swagger resolve conflict issue
maxceem Jun 8, 2021
425e62f
fix: payment amount calculation
maxceem Jun 8, 2021
cf3dec2
use payment scheduler step identifiers
xxcxy Jun 8, 2021
2118902
fix scheduler bugs
xxcxy Jun 9, 2021
0ec2d7f
fix: issue #316
yoution Jun 9, 2021
eb29a8c
Update helper.js
nkumar-topcoder Jun 9, 2021
a1cf99f
Update WorkPeriodService.js
nkumar-topcoder Jun 9, 2021
cc5222d
Merge pull request #324 from topcoder-platform/feature/topic-bus-key
nkumar-topcoder Jun 9, 2021
e36a53e
Update helper.js
nkumar-topcoder Jun 9, 2021
7c80214
Update WorkPeriodService.js
nkumar-topcoder Jun 9, 2021
440234d
Merge pull request #325 from topcoder-platform/feature/topic-bus-key
nkumar-topcoder Jun 9, 2021
7894bb5
Merge pull request #306 from eisbilir/new-action-topic
maxceem Jun 9, 2021
c24752a
Merge pull request #315 from topcoder-platform/feature/add-jobIds
LieutenantRoger Jun 9, 2021
6eccb50
Merge pull request #319 from xxcxy/feature/payment-scheduler
maxceem Jun 9, 2021
7c8cf21
fix: payment schedule for real payments
maxceem Jun 9, 2021
af6e988
fix #307
xxcxy Jun 9, 2021
ae782d5
job description parser
eisbilir Jun 9, 2021
509adf8
Merge pull request #322 from yoution/hotfix/job-status2
LieutenantRoger Jun 10, 2021
60660ce
Merge branch 'dev' into hotfix/job-status
Jun 10, 2021
5f33ef0
Merge pull request #328 from topcoder-platform/hotfix/job-status
LieutenantRoger Jun 10, 2021
7c67759
Merge pull request #327 from xxcxy/dev
maxceem Jun 10, 2021
9d4d436
Merge branch 'dev' into feature/payment-scheduler
maxceem Jun 10, 2021
4064e5e
set RB dates to null logic
eisbilir Jun 10, 2021
7f168a4
fix #332
xxcxy Jun 11, 2021
e2fc2dd
fix: Added allow empty validation for string fields in Job and Jobs C…
sushilshinde Jun 11, 2021
75b9baf
ci: deploy on dev env
sushilshinde Jun 11, 2021
705ef9d
Merge pull request #318 from topcoder-platform/feature/payment-scheduler
maxceem Jun 11, 2021
5d23c81
fix: migration script for scheduler
maxceem Jun 11, 2021
ff91b38
fix: added annunal, another rate type
sushilshinde Jun 11, 2021
09368f1
fix: allow empty string
sushilshinde Jun 11, 2021
d898555
fix: allow empty
sushilshinde Jun 11, 2021
dcb0a13
fix: empty string fix
sushilshinde Jun 11, 2021
bf32afb
fix: updated swagger
sushilshinde Jun 11, 2021
da72528
Include addition param key to Postevent method #329
xxcxy Jun 11, 2021
6d4a177
Merge pull request #336 from xxcxy/feature/topic-bus-key
maxceem Jun 11, 2021
e4a0201
docs: improve README
maxceem Jun 11, 2021
cc7749b
Merge pull request #335 from topcoder-platform/change-validatations-i…
sushilshinde Jun 11, 2021
f7706b7
Merge pull request #338 from topcoder-platform/feature/topic-bus-key
maxceem Jun 11, 2021
66b97a5
Merge branch 'dev' into dev
maxceem Jun 11, 2021
3f131e0
Merge pull request #333 from xxcxy/dev
maxceem Jun 11, 2021
e6e5348
fix: lint
maxceem Jun 11, 2021
6ba5f16
docs: improve Swagger
maxceem Jun 11, 2021
cf7aeac
fix #337
xxcxy Jun 11, 2021
30c627a
calculate daysWorked
eisbilir Jun 11, 2021
90d0a00
Merge remote-tracking branch 'upstream/dev' into dev
eisbilir Jun 11, 2021
01c6595
daysWorked constraint
eisbilir Jun 11, 2021
fb3bcc8
fix search WorkPeriod
xxcxy Jun 12, 2021
216c256
clear unnecessary function call
eisbilir Jun 13, 2021
627118d
Merge dev into feature/role-jd-parser2 - resolve conflict
eisbilir Jun 13, 2021
e579f1c
Merge pull request #343 from eisbilir/feature/role-jd-parser2
nikolay83 Jun 13, 2021
8bb17e5
wp-wpp update and automation
eisbilir Jun 13, 2021
f14dc4c
Merge pull request #344 from topcoder-platform/feature/role-jd-parser2
nikolay83 Jun 14, 2021
bf00b25
Merge pull request #341 from xxcxy/dev
maxceem Jun 14, 2021
02204c6
fix: allow multiple payment status in query payment
maxceem Jun 14, 2021
49c6395
Revert "Feature/role jd parser2"
urwithat Jun 14, 2021
95e0581
Merge pull request #346 from topcoder-platform/revert-344-feature/rol…
urwithat Jun 14, 2021
ff8c4e0
Revert "Revert "Feature/role jd parser2""
nikolay83 Jun 14, 2021
9db3798
use paymentStatus constats
eisbilir Jun 14, 2021
8096c4d
Merge branch 'dev' into work-period-automation
eisbilir Jun 14, 2021
d8bcc78
update postman
eisbilir Jun 14, 2021
6c630b4
Merge pull request #347 from topcoder-platform/revert-346-revert-344-…
urwithat Jun 15, 2021
e66100c
Moved file stopWords.json from docs to data
urwithat Jun 15, 2021
a5cba61
improve jd parser
eisbilir Jun 15, 2021
04af7f1
payment status calculation
eisbilir Jun 15, 2021
b82f8c3
Merge branch 'dev' into work-period-automation
eisbilir Jun 15, 2021
015a796
fix: project creation & missing job data
eisbilir Jun 16, 2021
f3f20f3
Merge pull request #350 from eisbilir/role-quick-fixes
nikolay83 Jun 16, 2021
8249acc
Merge pull request #349 from eisbilir/improve-jd-parser
nikolay83 Jun 16, 2021
e68e4fc
fix: workPeriod update
eisbilir Jun 16, 2021
acd1e0b
Merge pull request #351 from topcoder-platform/role-quick-fixes
nikolay83 Jun 16, 2021
47d188e
Merge pull request #345 from eisbilir/work-period-automation
maxceem Jun 16, 2021
2d2a3b8
chore: user 10 partions for Kafka events locally
maxceem Jun 16, 2021
73c1efc
fix: WP update endpoint fixes
maxceem Jun 16, 2021
09d3636
fix: only retry erros with code 500
maxceem Jun 16, 2021
52469f3
feate: sort WP inside RB by startDate for comfort
maxceem Jun 16, 2021
b0242d8
refactor: various payment code improvements
maxceem Jun 16, 2021
961d535
Merge pull request #352 from topcoder-platform/feature/work-period-au…
nkumar-topcoder Jun 16, 2021
93f136f
fix: migration script
maxceem Jun 16, 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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ workflows:
branches:
only:
- dev
- change-validatations-in-job-jc

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
tc-taas-es-processor | [2021-04-09T21:20:19.035Z] app INFO : Starting kafka consumer
tc-taas-es-processor | 2021-04-09T21:20:21.292Z INFO no-kafka-client Joined group taas-es-processor generationId 1 as no-kafka-client-076538fc-60dd-4ca4-a2b9-520bdf73bc9e
tc-taas-es-processor | 2021-04-09T21:20:21.293Z INFO no-kafka-client Elected as group leader
tc-taas-es-processor | 2021-04-09T21:20:21.449Z DEBUG no-kafka-client Subscribed to taas.role.update:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.450Z DEBUG no-kafka-client Subscribed to taas.role.delete:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.451Z DEBUG no-kafka-client Subscribed to taas.role.requested:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.452Z DEBUG no-kafka-client Subscribed to taas.jobcandidate.create:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.455Z DEBUG no-kafka-client Subscribed to taas.job.create:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.456Z DEBUG no-kafka-client Subscribed to taas.resourcebooking.delete:0 offset 0 leader kafka:9093
Expand All @@ -100,10 +103,11 @@
tc-taas-es-processor | 2021-04-09T21:20:21.469Z DEBUG no-kafka-client Subscribed to taas.workperiodpayment.update:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.470Z DEBUG no-kafka-client Subscribed to taas.workperiodpayment.delete:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.471Z DEBUG no-kafka-client Subscribed to taas.workperiodpayment.create:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.472Z DEBUG no-kafka-client Subscribed to taas.action.retry:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.473Z DEBUG no-kafka-client Subscribed to taas.job.update:0 offset 0 leader kafka:9093
tc-taas-es-processor | 2021-04-09T21:20:21.474Z DEBUG no-kafka-client Subscribed to taas.resourcebooking.update:0 offset 0 leader kafka:9093
tc-taas-es-processor | [2021-04-09T21:20:21.475Z] app INFO : Initialized.......
tc-taas-es-processor | [2021-04-09T21:20:21.479Z] app INFO : taas.job.create,taas.job.update,taas.job.delete,taas.jobcandidate.create,taas.jobcandidate.update,taas.jobcandidate.delete,taas.resourcebooking.create,taas.resourcebooking.update,taas.resourcebooking.delete,taas.workperiod.create,taas.workperiod.update,taas.workperiod.delete,taas.workperiodpayment.create,taas.workperiodpayment.update,taas.workperiodpayment.delete
tc-taas-es-processor | [2021-04-09T21:20:21.479Z] app INFO : common.error.reporting,taas.job.create,taas.job.update,taas.job.delete,taas.jobcandidate.create,taas.jobcandidate.update,taas.jobcandidate.delete,taas.resourcebooking.create,taas.resourcebooking.update,taas.resourcebooking.delete,taas.workperiod.create,taas.workperiod.update,taas.workperiod.delete,taas.workperiodpayment.create,taas.workperiodpayment.update,taas.interview.requested,taas.interview.update,taas.interview.bulkUpdate,taas.role.requested,taas.role.update,taas.role.delete,taas.action.retry
tc-taas-es-processor | [2021-04-09T21:20:21.480Z] app INFO : Kick Start.......
tc-taas-es-processor | ********** Topcoder Health Check DropIn listening on port 3001
tc-taas-es-processor | Topcoder Health Check DropIn started and ready to roll
Expand Down Expand Up @@ -173,6 +177,19 @@ To be able to change and test `taas-es-processor` locally you can follow the nex
2. Run `taas-es-processor` separately from the source code. As `npm run services:up` already run all the dependencies for both `taas-apis` and for `taas-es-processor`. The only thing you need to do for running `taas-es-processor` locally is clone the [taas-es-processor](https://github.com/topcoder-platform/taas-es-processor) repository and inside `taas-es-processor` folder run:
- `nvm use` - to use correct Node version
- `npm run install`
- Create `.env` file with the next environment variables. Values for **Auth0 config** should be shared with you on the forum.<br>

```bash
# Auth0 config
AUTH0_URL=
AUTH0_AUDIENCE=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
```

- Values from this file would be automatically used by many `npm` commands.
- ⚠️ Never commit this file or its copy to the repository!

- `npm run start`

## NPM Commands
Expand All @@ -194,7 +211,7 @@ To be able to change and test `taas-es-processor` locally you can follow the nex
| `npm run index:jobs <jobId>` | Indexes job data from db into ES, if jobId is not given all data is indexed. Use `-- --force` flag to skip confirmation |
| `npm run index:job-candidates <jobCandidateId>` | Indexes job candidate data from db into ES, if jobCandidateId is not given all data is indexed. Use `-- --force` flag to skip confirmation |
| `npm run index:resource-bookings <resourceBookingsId>` | Indexes resource bookings data from db into ES, if resourceBookingsId is not given all data is indexed. Use `-- --force` flag to skip confirmation |
| `npm run index:work-periods <workPeriodId>` | Indexes work periods data from db into ES, if workPeriodId is not given all data is indexed. Use `-- --force` flag to skip confirmation |
| `npm run index:roles <roleId>` | Indexes roles data from db into ES, if roleId is not given all data is indexed. Use `-- --force` flag to skip confirmation |
| `npm run services:up` | Start services via docker-compose for local development. |
| `npm run services:down` | Stop services via docker-compose for local development. |
| `npm run services:logs -- -f <service_name>` | View logs of some service inside docker-compose. |
Expand All @@ -203,6 +220,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" |

## Import and Export data

Expand Down
81 changes: 79 additions & 2 deletions app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const Scopes = {
ALL_RESOURCE_BOOKING: 'all:taas-resourceBookings',
// taas-team
READ_TAAS_TEAM: 'read:taas-teams',
CREATE_ROLE_SEARCH_REQUEST: 'create:taas-roleSearchRequests',
CREATE_TAAS_TEAM: 'create:taas-teams',
// work period
READ_WORK_PERIOD: 'read:taas-workPeriods',
CREATE_WORK_PERIOD: 'create:taas-workPeriods',
Expand All @@ -49,7 +51,13 @@ const Scopes = {
READ_INTERVIEW: 'read:taas-interviews',
CREATE_INTERVIEW: 'create:taas-interviews',
UPDATE_INTERVIEW: 'update:taas-interviews',
ALL_INTERVIEW: 'all:taas-interviews'
ALL_INTERVIEW: 'all:taas-interviews',
// role
READ_ROLE: 'read:taas-roles',
CREATE_ROLE: 'create:taas-roles',
UPDATE_ROLE: 'update:taas-roles',
DELETE_ROLE: 'delete:taas-roles',
ALL_ROLE: 'all:taas-roles'
}

// Interview related constants
Expand All @@ -76,16 +84,85 @@ const ChallengeStatus = {
COMPLETED: 'Completed'
}

/**
* Aggregate payment status for Work Period which is determined
* based on the payments the Work Period has using `PaymentStatusRules`
*/
const AggregatePaymentStatus = {
PENDING: 'pending',
IN_PROGRESS: 'in-progress',
PARTIALLY_COMPLETED: 'partially-completed',
COMPLETED: 'completed',
NO_DAYS: 'no-days'
}

/**
* `WorkPeriodPayment.status` - possible values
*/
const WorkPeriodPaymentStatus = {
COMPLETED: 'completed',
SCHEDULED: 'scheduled',
IN_PROGRESS: 'in-progress',
FAILED: 'failed',
CANCELLED: 'cancelled'
}

/**
* The rules how to determine WorkPeriod.paymentStatus based on the payments
*
* 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 } }
]

/**
* The WorkPeriodPayment.status values which we take into account when calculate
* aggregate values inside WorkPeriod:
* - daysPaid
* - paymentTotal
* - paymentStatus
*/
const ActiveWorkPeriodPaymentStatuses = [
WorkPeriodPaymentStatus.SCHEDULED,
WorkPeriodPaymentStatus.IN_PROGRESS,
WorkPeriodPaymentStatus.COMPLETED
]

const WorkPeriodPaymentUpdateStatus = {
SCHEDULED: 'scheduled',
CANCELLED: 'cancelled'
}

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

const PaymentSchedulerStatus = {
START_PROCESS: 'start-process',
CREATE_CHALLENGE: 'create-challenge',
ASSIGN_MEMBER: 'assign-member',
ACTIVATE_CHALLENGE: 'activate-challenge',
GET_USER_ID: 'get-userId',
CLOSE_CHALLENGE: 'close-challenge'
}

module.exports = {
UserRoles,
FullManagePermissionRoles,
Scopes,
Interviews,
ChallengeStatus,
PaymentProcessingSwitch
AggregatePaymentStatus,
WorkPeriodPaymentStatus,
WorkPeriodPaymentUpdateStatus,
PaymentSchedulerStatus,
PaymentProcessingSwitch,
PaymentStatusRules,
ActiveWorkPeriodPaymentStatuses
}
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const schedule = require('node-schedule')
const logger = require('./src/common/logger')
const eventHandlers = require('./src/eventHandlers')
const interviewService = require('./src/services/InterviewService')
const { processScheduler } = require('./src/services/PaymentSchedulerService')

// setup express app
const app = express()
Expand Down Expand Up @@ -97,6 +98,9 @@ const server = app.listen(app.get('port'), () => {
eventHandlers.init()
// schedule updateCompletedInterviews to run every hour
schedule.scheduleJob('0 0 * * * *', interviewService.updateCompletedInterviews)

// schedule payment processing
schedule.scheduleJob(config.PAYMENT_PROCESSING.CRON, processScheduler)
})

if (process.env.NODE_ENV === 'test') {
Expand Down
58 changes: 53 additions & 5 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {

TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',
// the api to find topcoder members
TOPCODER_MEMBERS_API: process.env.TOPCODER_MEMBERS_API || 'https://api.topcoder-dev.com/v3/members',
TOPCODER_MEMBERS_API: process.env.TOPCODER_MEMBERS_API || 'https://api.topcoder-dev.com/v5/members',
// rate limit of requests to user api
MAX_PARALLEL_REQUEST_TOPCODER_USERS_API: process.env.MAX_PARALLEL_REQUEST_TOPCODER_USERS_API || 100,

Expand Down Expand Up @@ -76,8 +76,8 @@ module.exports = {
ES_INDEX_JOB_CANDIDATE: process.env.ES_INDEX_JOB_CANDIDATE || 'job_candidate',
// the resource booking index
ES_INDEX_RESOURCE_BOOKING: process.env.ES_INDEX_RESOURCE_BOOKING || 'resource_booking',
// the work period index
ES_INDEX_WORK_PERIOD: process.env.ES_INDEX_WORK_PERIOD || 'work_period',
// the role index
ES_INDEX_ROLE: process.env.ES_INDEX_ROLE || 'role',

// the max bulk size in MB for ES indexing
MAX_BULK_REQUEST_SIZE_MB: process.env.MAX_BULK_REQUEST_SIZE_MB || 20,
Expand Down Expand Up @@ -133,6 +133,15 @@ module.exports = {
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',
// topics for role service
// the create role entity Kafka message topic
TAAS_ROLE_CREATE_TOPIC: process.env.TAAS_ROLE_CREATE_TOPIC || 'taas.role.requested',
// the update role entity Kafka message topic
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',
// special kafka topics
TAAS_ACTION_RETRY_TOPIC: process.env.TAAS_ACTION_RETRY_TOPIC || 'taas.action.retry',

// the Kafka message topic for sending email
EMAIL_TOPIC: process.env.EMAIL_TOPIC || 'external.action.email',
Expand Down Expand Up @@ -163,6 +172,45 @@ module.exports = {
TYPE_ID_TASK: process.env.TYPE_ID_TASK || 'ecd58c69-238f-43a4-a4bb-d172719b9f31',
DEFAULT_TIMELINE_TEMPLATE_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '53a307ce-b4b3-4d6f-b9a1-3741a58f77e6',
DEFAULT_TRACK_ID: process.env.DEFAULT_TRACK_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825',

PAYMENT_PROCESSING_SWITCH: process.env.PAYMENT_PROCESSING_SWITCH || 'OFF'
// the minimum matching rate when searching roles by skills
ROLE_MATCHING_RATE: process.env.ROLE_MATCHING_RATE || 0.70,
// member groups representing Wipro or TopCoder employee
INTERNAL_MEMBER_GROUPS: process.env.INTERNAL_MEMBER_GROUPS || ['20000000', '20000001', '20000003', '20000010', '20000015'],
// Topcoder skills cache time in minutes
TOPCODER_SKILLS_CACHE_TIME: process.env.TOPCODER_SKILLS_CACHE_TIME || 60,
// payment scheduler config
PAYMENT_PROCESSING: {
// switch off actual API calls in Payment Scheduler
SWITCH: process.env.PAYMENT_PROCESSING_SWITCH || 'OFF',
// the payment scheduler cron config
CRON: process.env.PAYMENT_PROCESSING_CRON || '0 */5 * * * *',
// the number of records processed by one time
BATCH_SIZE: parseInt(process.env.PAYMENT_PROCESSING_BATCH_SIZE || 50),
// in-progress expired to determine whether a record has been processed abnormally, moment duration format
IN_PROGRESS_EXPIRED: process.env.IN_PROGRESS_EXPIRED || 'PT1H',
// the number of max retry config
MAX_RETRY_COUNT: parseInt(process.env.PAYMENT_PROCESSING_MAX_RETRY_COUNT || 10),
// the time of retry base delay, unit: ms
RETRY_BASE_DELAY: parseInt(process.env.PAYMENT_PROCESSING_RETRY_BASE_DELAY || 100),
// the time of retry max delay, unit: ms
RETRY_MAX_DELAY: parseInt(process.env.PAYMENT_PROCESSING_RETRY_MAX_DELAY || 10000),
// the max time of one request, unit: ms
PER_REQUEST_MAX_TIME: parseInt(process.env.PAYMENT_PROCESSING_PER_REQUEST_MAX_TIME || 30000),
// the max time of one payment record, unit: ms
PER_PAYMENT_MAX_TIME: parseInt(process.env.PAYMENT_PROCESSING_PER_PAYMENT_MAX_TIME || 60000),
// the max records of payment of a minute
PER_MINUTE_PAYMENT_MAX_COUNT: parseInt(process.env.PAYMENT_PROCESSING_PER_MINUTE_PAYMENT_MAX_COUNT || 12),
// the max requests of challenge of a minute
PER_MINUTE_CHALLENGE_REQUEST_MAX_COUNT: parseInt(process.env.PAYMENT_PROCESSING_PER_MINUTE_CHALLENGE_REQUEST_MAX_COUNT || 60),
// the max requests of resource of a minute
PER_MINUTE_RESOURCE_REQUEST_MAX_COUNT: parseInt(process.env.PAYMENT_PROCESSING_PER_MINUTE_CHALLENGE_REQUEST_MAX_COUNT || 20),
// the default step fix delay, unit: ms
FIX_DELAY_STEP: parseInt(process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP || 500),
// the fix delay after step of create challenge, unit: ms
FIX_DELAY_STEP_CREATE_CHALLENGE: parseInt(process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP_CREATE_CHALLENGE || process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP || 500),
// the fix delay after step of assign member, unit: ms
FIX_DELAY_STEP_ASSIGN_MEMBER: parseInt(process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP_ASSIGN_MEMBER || process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP || 500),
// the fix delay after step of activate challenge, unit: ms
FIX_DELAY_STEP_ACTIVATE_CHALLENGE: parseInt(process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP_ACTIVATE_CHALLENGE || process.env.PAYMENT_PROCESSING_FIX_DELAY_STEP || 500)
}
}
Loading