Skip to content

Commit ea22578

Browse files
Changes for resource bookings
1 parent f5d1133 commit ea22578

8 files changed

+65
-62
lines changed

src/routes/HealthCheckRoutes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
module.exports = {
6-
'/health': {
6+
'/taas/health': {
77
get: {
88
controller: 'HealthCheckController',
99
method: 'checkHealth'

src/services/ResourceBookingService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function _cacheModelFields () {
4646
* @returns {Boolean} true if user is machine and has read/all workPeriod scopes
4747
*/
4848
function _checkUserScopesForGetWorkPeriods (currentUser) {
49-
const getWorkPeriodsScopes = [constants.Scopes.READ_WORK_PERIOD, constants.Scopes.ALL_WORK_PERIOD]
49+
const getWorkPeriodsScopes = [constants.Scopes.READ_WORK_PERIOD, constants.Scopes.ALL_WORK_PERIOD, constants.Scopes.ALL_RESOURCES]
5050
return currentUser.isMachine && helper.checkIfExists(getWorkPeriodsScopes, currentUser.scopes)
5151
}
5252

test/postman/testData/resourceBooking/add-dates-to-resourceBooking.json

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@
99
"httpStatus": 200,
1010
"responseBody": {
1111
"projectId": 222,
12-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1001",
12+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
1313
"startDate": "2021-05-23",
1414
"endDate": "2021-05-29",
1515
"memberRate": 13.23,
1616
"customerRate": 13,
1717
"rateType": "hourly",
1818
"billingAccountId": 80000071,
19-
"status": "placed",
20-
"createdBy": "00000000-0000-0000-0000-000000000000",
21-
"updatedBy": "00000000-0000-0000-0000-000000000000"
19+
"sendWeeklySurvey": true,
20+
"status": "placed"
2221
}
2322
},
2423
{
@@ -31,16 +30,15 @@
3130
"httpStatus": 200,
3231
"responseBody": {
3332
"projectId": 111,
34-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1002",
33+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
3534
"startDate": "2021-05-23",
3635
"endDate": "2021-05-29",
3736
"memberRate": 13.23,
3837
"customerRate": 13,
3938
"rateType": "hourly",
4039
"billingAccountId": 80000071,
41-
"status": "placed",
42-
"createdBy": "00000000-0000-0000-0000-000000000000",
43-
"updatedBy": "00000000-0000-0000-0000-000000000000"
40+
"sendWeeklySurvey": true,
41+
"status": "placed"
4442
}
4543
},
4644
{
@@ -53,16 +51,15 @@
5351
"httpStatus": 200,
5452
"responseBody": {
5553
"projectId": 111,
56-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1003",
54+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
5755
"startDate": "2021-05-23",
5856
"endDate": "2021-05-29",
5957
"memberRate": 13.23,
6058
"customerRate": 13,
6159
"rateType": "hourly",
6260
"billingAccountId": 80000071,
63-
"status": "placed",
64-
"createdBy": "00000000-0000-0000-0000-000000000000",
65-
"updatedBy": "00000000-0000-0000-0000-000000000000"
61+
"sendWeeklySurvey": true,
62+
"status": "placed"
6663
}
6764
},
6865
{
@@ -75,16 +72,15 @@
7572
"httpStatus": 200,
7673
"responseBody": {
7774
"projectId": 222,
78-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1004",
75+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
7976
"startDate": "2021-05-23",
8077
"endDate": "2021-05-29",
8178
"memberRate": 13.23,
8279
"customerRate": 13,
8380
"rateType": "hourly",
8481
"billingAccountId": 80000071,
85-
"status": "placed",
86-
"createdBy": "00000000-0000-0000-0000-000000000000",
87-
"updatedBy": "00000000-0000-0000-0000-000000000000"
82+
"sendWeeklySurvey": true,
83+
"status": "placed"
8884
}
8985
},
9086
{
@@ -97,16 +93,15 @@
9793
"httpStatus": 200,
9894
"responseBody": {
9995
"projectId": 222,
100-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1005",
96+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
10197
"startDate": "2021-05-23",
10298
"endDate": "2021-05-29",
10399
"memberRate": 13.23,
104100
"customerRate": 13,
105101
"rateType": "hourly",
106102
"billingAccountId": 80000071,
107-
"status": "placed",
108-
"createdBy": "00000000-0000-0000-0000-000000000000",
109-
"updatedBy": "00000000-0000-0000-0000-000000000000"
103+
"sendWeeklySurvey": true,
104+
"status": "placed"
110105
}
111106
}
112107
]

test/postman/testData/resourceBooking/create-resourceBooking-by-invalid-field.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"billingAccountId": 80000071
151151
},
152152
"httpStatus": 400,
153-
"message": "\"resourceBooking.rateType\" must be one of \\[hourly, daily, weekly, monthly\\]"
153+
"message": "\"resourceBooking.rateType\" must be one of \\[hourly, daily, weekly, monthly, annual\\]"
154154
},
155155
{
156156
"token": "m2m_token",

test/postman/testData/resourceBooking/get-resourceBooking-successfully-fromDb-with-parameters.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"httpStatus": 200,
99
"responseBody": {
1010
"projectId": 222,
11-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1001",
11+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
1212
"startDate": "2021-05-23",
1313
"endDate": "2021-05-29",
1414
"memberRate": 13.23,
1515
"workPeriods": [
1616
{
17-
"daysWorked": null,
17+
"daysWorked": 5,
1818
"paymentStatus": "pending"
1919
}
2020
]
@@ -29,7 +29,7 @@
2929
"httpStatus": 200,
3030
"responseBody": {
3131
"projectId": 111,
32-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1002",
32+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
3333
"startDate": "2021-05-23",
3434
"endDate": "2021-05-29",
3535
"workPeriods": [
@@ -44,7 +44,7 @@
4444
"token": "user_token",
4545
"resourceBookingId": "ResourceBookingId-3",
4646
"requestParameters": {
47-
"fields": "projectId,status,startDate,billingAccountId,customerRate,workPeriods.userHandle,workPeriods.customerRate"
47+
"fields": "projectId,status,startDate,billingAccountId,customerRate,workPeriods.userHandle"
4848
},
4949
"httpStatus": 200,
5050
"responseBody": {
@@ -55,8 +55,7 @@
5555
"customerRate": 13,
5656
"workPeriods": [
5757
{
58-
"userHandle": "userHandle",
59-
"customerRate": null
58+
"userHandle": "lazybaer"
6059
}
6160
]
6261
}
@@ -65,7 +64,7 @@
6564
"token": "m2m_token",
6665
"resourceBookingId": "ResourceBookingId-4",
6766
"requestParameters": {
68-
"fields": "memberRate,status,startDate,billingAccountId,memberRate,workPeriods.userHandle,workPeriods.customerRate,workPeriods.startDate,workPeriods.endDate"
67+
"fields": "memberRate,status,startDate,billingAccountId,memberRate,workPeriods.userHandle,workPeriods.startDate,workPeriods.endDate"
6968
},
7069
"httpStatus": 200,
7170
"responseBody": {
@@ -92,13 +91,13 @@
9291
"httpStatus": 200,
9392
"responseBody": {
9493
"projectId": 222,
95-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1005",
94+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
9695
"startDate": "2021-05-23",
9796
"endDate": "2021-05-29",
9897
"memberRate": 13.23,
9998
"workPeriods": [
10099
{
101-
"daysWorked": null,
100+
"daysWorked": 5,
102101
"paymentStatus": "pending"
103102
}
104103
]

test/postman/testData/resourceBooking/get-resourceBooking-successfully-fromDb.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
"httpStatus": 200,
66
"responseBody": {
77
"projectId": 222,
8-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1001",
8+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
99
"startDate": "2021-05-23",
1010
"endDate": "2021-05-29",
1111
"memberRate": 13.23,
1212
"customerRate": 13,
1313
"rateType": "hourly",
1414
"billingAccountId": 80000071,
1515
"status": "placed",
16-
"createdBy": "00000000-0000-0000-0000-000000000000",
17-
"updatedBy": "00000000-0000-0000-0000-000000000000"
16+
"sendWeeklySurvey": true
1817
}
1918
},
2019
{
@@ -23,15 +22,15 @@
2322
"httpStatus": 200,
2423
"responseBody": {
2524
"projectId": 111,
26-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1002",
25+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
2726
"startDate": "2021-05-23",
2827
"endDate": "2021-05-29",
28+
"memberRate":13.23,
2929
"customerRate": 13,
3030
"rateType": "hourly",
3131
"billingAccountId": 80000071,
3232
"status": "placed",
33-
"createdBy": "00000000-0000-0000-0000-000000000000",
34-
"updatedBy": "00000000-0000-0000-0000-000000000000"
33+
"sendWeeklySurvey": true
3534
}
3635
},
3736
{
@@ -40,15 +39,15 @@
4039
"httpStatus": 200,
4140
"responseBody": {
4241
"projectId": 111,
43-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1003",
42+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
4443
"startDate": "2021-05-23",
4544
"endDate": "2021-05-29",
45+
"memberRate":13.23,
4646
"customerRate": 13,
4747
"rateType": "hourly",
4848
"billingAccountId": 80000071,
4949
"status": "placed",
50-
"createdBy": "00000000-0000-0000-0000-000000000000",
51-
"updatedBy": "00000000-0000-0000-0000-000000000000"
50+
"sendWeeklySurvey": true
5251
}
5352
},
5453
{
@@ -57,16 +56,15 @@
5756
"httpStatus": 200,
5857
"responseBody": {
5958
"projectId": 222,
60-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1004",
59+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
6160
"startDate": "2021-05-23",
6261
"endDate": "2021-05-29",
6362
"memberRate": 13.23,
6463
"customerRate": 13,
6564
"rateType": "hourly",
6665
"billingAccountId": 80000071,
6766
"status": "placed",
68-
"createdBy": "00000000-0000-0000-0000-000000000000",
69-
"updatedBy": "00000000-0000-0000-0000-000000000000"
67+
"sendWeeklySurvey": true
7068
}
7169
},
7270
{
@@ -75,16 +73,15 @@
7573
"httpStatus": 200,
7674
"responseBody": {
7775
"projectId": 222,
78-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1005",
76+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
7977
"startDate": "2021-05-23",
8078
"endDate": "2021-05-29",
8179
"memberRate": 13.23,
8280
"customerRate": 13,
8381
"rateType": "hourly",
8482
"billingAccountId": 80000071,
8583
"status": "placed",
86-
"createdBy": "00000000-0000-0000-0000-000000000000",
87-
"updatedBy": "00000000-0000-0000-0000-000000000000"
84+
"sendWeeklySurvey": true
8885
}
8986
}
9087
]

test/postman/testData/resourceBooking/get-resourceBooking-successfully.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
"httpStatus": 200,
66
"responseBody": {
77
"projectId": 222,
8-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1001",
8+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
99
"startDate": "2021-05-23",
1010
"endDate": "2021-05-29",
1111
"memberRate": 13.23,
1212
"customerRate": 13,
1313
"rateType": "hourly",
1414
"billingAccountId": 80000071,
1515
"status": "placed",
16-
"createdBy": "00000000-0000-0000-0000-000000000000",
17-
"updatedBy": "00000000-0000-0000-0000-000000000000"
16+
"sendWeeklySurvey":true
1817
}
1918
},
2019
{
@@ -23,15 +22,15 @@
2322
"httpStatus": 200,
2423
"responseBody": {
2524
"projectId": 111,
26-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1002",
25+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
2726
"startDate": "2021-05-23",
2827
"endDate": "2021-05-29",
28+
"memberRate": 13.23,
2929
"customerRate": 13,
3030
"rateType": "hourly",
3131
"billingAccountId": 80000071,
3232
"status": "placed",
33-
"createdBy": "00000000-0000-0000-0000-000000000000",
34-
"updatedBy": "00000000-0000-0000-0000-000000000000"
33+
"sendWeeklySurvey":true
3534
}
3635
},
3736
{
@@ -40,15 +39,15 @@
4039
"httpStatus": 200,
4140
"responseBody": {
4241
"projectId": 111,
43-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1003",
42+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
4443
"startDate": "2021-05-23",
4544
"endDate": "2021-05-29",
45+
"memberRate": 13.23,
4646
"customerRate": 13,
4747
"rateType": "hourly",
4848
"billingAccountId": 80000071,
4949
"status": "placed",
50-
"createdBy": "00000000-0000-0000-0000-000000000000",
51-
"updatedBy": "00000000-0000-0000-0000-000000000000"
50+
"sendWeeklySurvey":true
5251
}
5352
},
5453
{
@@ -57,16 +56,15 @@
5756
"httpStatus": 200,
5857
"responseBody": {
5958
"projectId": 222,
60-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1004",
59+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
6160
"startDate": "2021-05-23",
6261
"endDate": "2021-05-29",
6362
"memberRate": 13.23,
6463
"customerRate": 13,
6564
"rateType": "hourly",
6665
"billingAccountId": 80000071,
6766
"status": "placed",
68-
"createdBy": "00000000-0000-0000-0000-000000000000",
69-
"updatedBy": "00000000-0000-0000-0000-000000000000"
67+
"sendWeeklySurvey":true
7068
}
7169
},
7270
{
@@ -75,16 +73,15 @@
7573
"httpStatus": 200,
7674
"responseBody": {
7775
"projectId": 222,
78-
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c1005",
76+
"userId": "0bcb0d86-09bb-410a-b2b1-fba90d1a7699",
7977
"startDate": "2021-05-23",
8078
"endDate": "2021-05-29",
8179
"memberRate": 13.23,
8280
"customerRate": 13,
8381
"rateType": "hourly",
8482
"billingAccountId": 80000071,
8583
"status": "placed",
86-
"createdBy": "00000000-0000-0000-0000-000000000000",
87-
"updatedBy": "00000000-0000-0000-0000-000000000000"
84+
"sendWeeklySurvey":true
8885
}
8986
}
9087
]

0 commit comments

Comments
 (0)