Skip to content

Commit b2a9e91

Browse files
authored
Merge branch 'dev' into issue-431
2 parents 8949ec3 + 21ae6fa commit b2a9e91

File tree

12 files changed

+148
-137
lines changed

12 files changed

+148
-137
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ To be able to change and test `taas-es-processor` locally you can follow the nex
215215
| `npm run services:up` | Start services via docker-compose for local development. |
216216
| `npm run services:down` | Stop services via docker-compose for local development. |
217217
| `npm run services:logs -- -f <service_name>` | View logs of some service inside docker-compose. |
218+
| `npm run services:rebuild -- -f <service_name>` | Rebuild service container ignoring cache (useful when pushed something to the Git repository of service) |
218219
| `npm run local:init` | Recreate Database and Elasticsearch indexes and populate demo data for local development (removes any existent data). |
219220
| `npm run local:reset` | Recreate Database and Elasticsearch indexes (removes any existent data). |
220221
| `npm run cov` | Code Coverage Report. |
@@ -337,6 +338,6 @@ When we add, update or delete models and/or endpoints we have to make sure that
337338
- 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`.
338339
339340
## EMSI mapping
340-
mapping EMSI tags to topcoder skills
341-
Run `npm run emsi-mapping` to create the mapping file
341+
mapping EMSI tags to topcoder skills
342+
Run `npm run emsi-mapping` to create the mapping file
342343
It will take about 15 minutes to create the mapping file `script/emsi-mapping/emsi-skils-mapping.js`

docs/Topcoder-bookings-api.postman_collection.json

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "9d8bfd2b-8864-49fd-8c6e-4cff10095cc3",
3+
"_postman_id": "8ead1433-9679-46de-9baa-d27d59106673"
44
"name": "Topcoder-bookings-api",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
@@ -15486,7 +15486,7 @@
1548615486
"pm.test('Status code is 400', function () {\r",
1548715487
" pm.response.to.have.status(400);\r",
1548815488
" const response = pm.response.json()\r",
15489-
" pm.expect(response.message).to.eq(\"\\\"data.daysWorked\\\" must be less than or equal to 5\")\r",
15489+
" pm.expect(response.message).to.eq(\"\\\"data.daysWorked\\\" must be less than or equal to 10\")\r",
1549015490
"});"
1549115491
],
1549215492
"type": "text/javascript"
@@ -15504,55 +15504,7 @@
1550415504
],
1550515505
"body": {
1550615506
"mode": "raw",
15507-
"raw": "{\r\n \"daysWorked\": 6\r\n}",
15508-
"options": {
15509-
"raw": {
15510-
"language": "json"
15511-
}
15512-
}
15513-
},
15514-
"url": {
15515-
"raw": "{{URL}}/work-periods/{{workPeriodId-1}}",
15516-
"host": [
15517-
"{{URL}}"
15518-
],
15519-
"path": [
15520-
"work-periods",
15521-
"{{workPeriodId-1}}"
15522-
]
15523-
}
15524-
},
15525-
"response": []
15526-
},
15527-
{
15528-
"name": "patch work period with invalid parameter 4",
15529-
"event": [
15530-
{
15531-
"listen": "test",
15532-
"script": {
15533-
"exec": [
15534-
"pm.test('Status code is 400', function () {\r",
15535-
" pm.response.to.have.status(400);\r",
15536-
" const response = pm.response.json()\r",
15537-
" pm.expect(response.message).to.eq(\"Maximum allowed daysWorked is (4)\")\r",
15538-
"});"
15539-
],
15540-
"type": "text/javascript"
15541-
}
15542-
}
15543-
],
15544-
"request": {
15545-
"method": "PATCH",
15546-
"header": [
15547-
{
15548-
"key": "Authorization",
15549-
"type": "text",
15550-
"value": "Bearer {{token_bookingManager}}"
15551-
}
15552-
],
15553-
"body": {
15554-
"mode": "raw",
15555-
"raw": "{\r\n \"daysWorked\": 5\r\n}",
15507+
"raw": "{\r\n \"daysWorked\": 11\r\n}",
1555615508
"options": {
1555715509
"raw": {
1555815510
"language": "json"
@@ -16508,7 +16460,7 @@
1650816460
"pm.test('Status code is 400', function () {\r",
1650916461
" pm.response.to.have.status(400);\r",
1651016462
" const response = pm.response.json()\r",
16511-
" pm.expect(response.message).to.eq(\"\\\"workPeriodPayment.days\\\" must be less than or equal to 5\")\r",
16463+
" pm.expect(response.message).to.eq(\"\\\"workPeriodPayment.days\\\" must be less than or equal to 10\")\r",
1651216464
"});"
1651316465
],
1651416466
"type": "text/javascript"
@@ -16526,7 +16478,7 @@
1652616478
],
1652716479
"body": {
1652816480
"mode": "raw",
16529-
"raw": "{\r\n \"workPeriodId\": \"{{workPeriodId-3}}\",\r\n \"days\": 6\r\n}",
16481+
"raw": "{\r\n \"workPeriodId\": \"{{workPeriodId-3}}\",\r\n \"days\": 11\r\n}",
1653016482
"options": {
1653116483
"raw": {
1653216484
"language": "json"

docs/swagger.yaml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,7 +3947,7 @@ components:
39473947
"job-closed",
39483948
"offered",
39493949
"withdrawn",
3950-
"withdrawn-prescreen"
3950+
"withdrawn-prescreen",
39513951
]
39523952
description: "The job candidate status."
39533953
externalId:
@@ -4049,7 +4049,26 @@ components:
40494049
type: array
40504050
items:
40514051
type: string
4052-
enum: ["open", "placed", "selected", "client rejected - screening", "client rejected - interview", "rejected - other", "cancelled", "interview", "topcoder-rejected", "applied", "rejected-pre-screen", "skills-test", "phone-screen", "job-closed", "offered", "withdrawn", "withdrawn-prescreen"]
4052+
enum:
4053+
[
4054+
"open",
4055+
"placed",
4056+
"selected",
4057+
"client rejected - screening",
4058+
"client rejected - interview",
4059+
"rejected - other",
4060+
"cancelled",
4061+
"interview",
4062+
"topcoder-rejected",
4063+
"applied",
4064+
"rejected-pre-screen",
4065+
"skills-test",
4066+
"phone-screen",
4067+
"job-closed",
4068+
"offered",
4069+
"withdrawn",
4070+
"withdrawn-prescreen",
4071+
]
40534072
description: "The array of job Candidates status"
40544073
JobCandidateRequestBody:
40554074
required:
@@ -4085,7 +4104,7 @@ components:
40854104
"job-closed",
40864105
"offered",
40874106
"withdrawn",
4088-
"withdrawn-prescreen"
4107+
"withdrawn-prescreen",
40894108
]
40904109
description: "The job candidate status."
40914110
default: open
@@ -4123,7 +4142,7 @@ components:
41234142
"job-closed",
41244143
"offered",
41254144
"withdrawn",
4126-
"withdrawn-prescreen"
4145+
"withdrawn-prescreen",
41274146
]
41284147
externalId:
41294148
type: string
@@ -4644,7 +4663,7 @@ components:
46444663
daysWorked:
46454664
type: integer
46464665
minimum: 0
4647-
maximum: 5
4666+
maximum: 10
46484667
example: 2
46494668
description: "The count of the days worked for that work period."
46504669
daysPaid:
@@ -4696,6 +4715,8 @@ components:
46964715
properties:
46974716
daysWorked:
46984717
type: integer
4718+
minimum: 0
4719+
maximum: 10
46994720
example: 2
47004721
description: "The count of the days worked for that work period."
47014722
WorkPeriodPayment:
@@ -5299,7 +5320,7 @@ components:
52995320
"job-closed",
53005321
"offered",
53015322
"withdrawn",
5302-
"withdrawn-prescreen"
5323+
"withdrawn-prescreen",
53035324
]
53045325
description: "The job candidate status."
53055326
skills:
@@ -5896,5 +5917,3 @@ components:
58965917
properties:
58975918
message:
58985919
type: string
5899-
5900-

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"services:up": "docker-compose -f ./local/docker-compose.yml --env-file .env up -d",
2626
"services:down": "docker-compose -f ./local/docker-compose.yml down",
2727
"services:logs": "docker-compose -f ./local/docker-compose.yml logs",
28+
"services:rebuild": "docker-compose -f ./local/docker-compose.yml build --no-cache",
2829
"local:init": "npm run local:reset && npm run data:import -- --force",
2930
"local:reset": "npm run delete-index -- --force || true && npm run create-index -- --force && npm run init-db force",
3031
"cov": "nyc --reporter=html --reporter=text npm run test",

scripts/recruit-crm-job-import/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ By default the script creates jobs and resource bookings via `TC_API`.
1616
Follow the README for Taas API to deploy Taas API locally and then point the script to the local API by running:
1717

1818
``` bash
19+
export RCRM_IMPORT_CONFIG_NAMESAPCE=RCRM_IMPORT_
1920
export RCRM_IMPORT_TAAS_API_URL=http://localhost:3000/api/v5
2021
node scripts/recruit-crm-job-import scripts/recruit-crm-job-import/example_data.csv | tee /tmp/report.txt
2122
```
@@ -27,38 +28,42 @@ DEBUG: processing line #1 - {"directProjectId":"24568","projectId":"(dynamic loa
2728
WARN: #1 - externalId is missing
2829
DEBUG: processed line #1
2930
DEBUG: processing line #2 - {"directProjectId":"24568","projectId":"(dynamic load)","externalId":"0","title":"taas-demo-job5","startDate":"10/26/2020","endDate":"01/29/2021","numPositions":"2","userHandle":"not_found_handle","jobid":"(dynamic load)","customerRate":"20","memberRate":"10","_lnum":2}
30-
ERROR: #2 - handle: not_found_handle user not found
31+
ERROR: #2 - id: 51ce2216-0dee-4dcf-bf7d-79f862e8d63c job created; handle: not_found_handle user not found
3132
DEBUG: processed line #2
3233
DEBUG: processing line #3 - {"directProjectId":"24568","projectId":"(dynamic load)","externalId":"0","title":"taas-demo-job5","startDate":"10/26/2020","endDate":"01/29/2021","numPositions":"2","userHandle":"nkumartest","jobid":"(dynamic load)","customerRate":"20","memberRate":"10","_lnum":3}
3334
DEBUG: userHandle: nkumartest userId: 57646ff9-1cd3-4d3c-88ba-eb09a395366c
34-
DEBUG: resourceBookingId: dc8b23d4-9987-4a7d-a587-2056283223de status: assigned
35-
INFO: #3 - id: 7c8ed989-35bf-4899-9c93-708630a7c63b job already exists; id: dc8b23d4-9987-4a7d-a587-2056283223de resource booking created; id: dc8b23d4-9987-4a7d-a587-2056283223de status: assigned resource booking updated
35+
INFO: #3 - id: 51ce2216-0dee-4dcf-bf7d-79f862e8d63c externalId: 0 job already exists; id: d49d2fbd-ba11-49dc-8eaa-5afafa7e993f resource booking created
3636
DEBUG: processed line #3
3737
DEBUG: processing line #4 - {"directProjectId":"24567","projectId":"(dynamic load)","externalId":"1212","title":"Dummy Description","startDate":"10/20/2020","endDate":"01/29/2021","numPositions":"2","userHandle":"pshah_manager","jobid":"(dynamic load)","customerRate":"150","memberRate":"100","_lnum":4}
3838
DEBUG: userHandle: pshah_manager userId: a55fe1bc-1754-45fa-9adc-cf3d6d7c377a
39-
DEBUG: resourceBookingId: 708469fb-ead0-4fc3-bef7-1ef4dd041428 status: assigned
40-
INFO: #4 - id: f61da880-5295-40c2-b6db-21e6cdef93f9 job created; id: 708469fb-ead0-4fc3-bef7-1ef4dd041428 resource booking created; id: 708469fb-ead0-4fc3-bef7-1ef4dd041428 status: assigned resource booking updated
39+
INFO: #4 - id: e0267551-24fe-48b5-9605-719852901de2 job created; id: f6285f03-056d-446f-a69b-6d275a97d68a resource booking created
4140
DEBUG: processed line #4
4241
DEBUG: processing line #5 - {"directProjectId":"24566","projectId":"(dynamic load)","externalId":"23850272","title":"33fromzaps330","startDate":"02/21/2021","endDate":"03/15/2021","numPositions":"7","userHandle":"nkumar2","jobid":"(dynamic load)","customerRate":"50","memberRate":"30","_lnum":5}
4342
DEBUG: userHandle: nkumar2 userId: 4b00d029-c87b-47b2-bfe2-0ab80d8b5774
44-
DEBUG: resourceBookingId: 7870c30b-e511-48f2-8687-499ab116174f status: assigned
45-
INFO: #5 - id: 72dc0399-5e4b-4783-9a27-ea07a4ce99a7 job created; id: 7870c30b-e511-48f2-8687-499ab116174f resource booking created; id: 7870c30b-e511-48f2-8687-499ab116174f status: assigned resource booking updated
43+
INFO: #5 - id: cd94784c-432d-4c46-b860-04a89e7b1099 job created; id: 98604c13-c6f3-4203-b74f-db376e9f02e4 resource booking created
4644
DEBUG: processed line #5
4745
DEBUG: processing line #6 - {"directProjectId":"24565","projectId":"(dynamic load)","externalId":"23843365","title":"Designer","startDate":"02/24/2021","endDate":"03/30/2021","numPositions":"1","userHandle":"GunaK-TopCoder","jobid":"(dynamic load)","customerRate":"70","memberRate":"70","_lnum":6}
4846
DEBUG: userHandle: GunaK-TopCoder userId: 2bba34d5-20e4-46d6-bfc1-05736b17afbb
49-
DEBUG: resourceBookingId: b2e705d3-6864-4697-96bb-dc2a288755bc status: assigned
50-
INFO: #6 - id: 7ff0737e-958c-494e-8a5a-592ac1c5d4ff job created; id: b2e705d3-6864-4697-96bb-dc2a288755bc resource booking created; id: b2e705d3-6864-4697-96bb-dc2a288755bc status: assigned resource booking updated
47+
INFO: #6 - id: 49883150-59c2-4e5b-b5c3-aaf6d11d0da2 job created; id: 5505b6b5-050c-421c-893f-b862b1a08092 resource booking created
5148
DEBUG: processed line #6
5249
DEBUG: processing line #7 - {"directProjectId":"24564","projectId":"(dynamic load)","externalId":"23836459","title":"demo-dev-19janV4","startDate":"01/20/2021","endDate":"01/30/2021","numPositions":"1","userHandle":"nkumar1","jobid":"(dynamic load)","customerRate":"400","memberRate":"200","_lnum":7}
5350
DEBUG: userHandle: nkumar1 userId: ab19a53b-0607-4a99-8bdd-f3b0cb552293
54-
DEBUG: resourceBookingId: 04299b4c-3f6e-4b3e-ae57-bf8232408cf9 status: assigned
55-
INFO: #7 - id: 73301ade-40ff-4103-bd50-37b8d2a98183 job created; id: 04299b4c-3f6e-4b3e-ae57-bf8232408cf9 resource booking created; id: 04299b4c-3f6e-4b3e-ae57-bf8232408cf9 status: assigned resource booking updated
51+
INFO: #7 - id: b03dc641-d6be-4a15-9c86-ef38f0e20c28 job created; id: 8e332107-453b-4ec5-b934-902c829e73a2 resource booking created
5652
DEBUG: processed line #7
5753
INFO: === summary ===
5854
INFO: total: 7
5955
INFO: success: 5
6056
INFO: failure: 1
6157
INFO: skips: 1
58+
INFO: jobs created: 5
59+
INFO: resource bookings created: 5
60+
INFO: jobs already exist: 1
61+
INFO: resource bookings already exist: 0
62+
INFO: validation errors: 0
63+
INFO: user not found: 1
64+
INFO: external id missing: 1
65+
INFO: request error: 0
66+
INFO: internal error: 0
6267
INFO: === summary ===
6368
INFO: done!
6469
```

scripts/recruit-crm-job-import/helper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ async function getJobByExternalId (externalId) {
5454
* Update the status of a resource booking.
5555
*
5656
* @param {String} resourceBookingId the resource booking id
57-
* @param {String} status the status for the resource booking
57+
* @param {Object} data the data to update
5858
* @returns {Object} the result
5959
*/
60-
async function updateResourceBookingStatus (resourceBookingId, status) {
60+
async function updateResourceBooking (resourceBookingId, data) {
6161
const token = await getM2MToken()
6262
const { body: resourceBooking } = await request.patch(`${config.TAAS_API_URL}/resourceBookings/${resourceBookingId}`)
6363
.set('Authorization', `Bearer ${token}`)
6464
.set('Content-Type', 'application/json')
65-
.send({ status })
65+
.send(data)
6666
return resourceBooking
6767
}
6868

@@ -139,7 +139,7 @@ module.exports = {
139139
getPathnameFromCommandline: commonHelper.getPathnameFromCommandline,
140140
createJob,
141141
getJobByExternalId,
142-
updateResourceBookingStatus,
142+
updateResourceBooking,
143143
getResourceBookingByJobIdAndUserId,
144144
createResourceBooking,
145145
getUserByHandle,

0 commit comments

Comments
 (0)