Skip to content

Commit f7e81eb

Browse files
committed
rephrase validation messages
1 parent 0c858ca commit f7e81eb

File tree

2 files changed

+57
-5
lines changed

2 files changed

+57
-5
lines changed

docs/Topcoder-bookings-api.postman_collection.json

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12675,7 +12675,7 @@
1267512675
"pm.test('Status code is 400', function () {\r",
1267612676
" pm.response.to.have.status(400);\r",
1267712677
" const response = pm.response.json()\r",
12678-
" pm.expect(response.message).to.eq(\"Cannot set \\\"isFirstWeek\\\" without \\\"startDate\\\"\")\r",
12678+
" pm.expect(response.message).to.eq(\"Cannot filter by \\\"isLastWeek\\\" without \\\"startDate\\\"\")\r",
1267912679
"});"
1268012680
],
1268112681
"type": "text/javascript"
@@ -12727,7 +12727,59 @@
1272712727
"pm.test('Status code is 400', function () {\r",
1272812728
" pm.response.to.have.status(400);\r",
1272912729
" const response = pm.response.json()\r",
12730-
" pm.expect(response.message).to.eq(\"Cannot set both \\\"isFirstWeek\\\" and \\\"isLastWeek\\\" to \\\"true\\\"\")\r",
12730+
" pm.expect(response.message).to.eq(\"Cannot filter by \\\"isFirstWeek\\\" without \\\"startDate\\\"\")\r",
12731+
"});"
12732+
],
12733+
"type": "text/javascript"
12734+
}
12735+
}
12736+
],
12737+
"request": {
12738+
"method": "GET",
12739+
"header": [
12740+
{
12741+
"key": "Authorization",
12742+
"type": "text",
12743+
"value": "Bearer {{token_bookingManager}}"
12744+
}
12745+
],
12746+
"url": {
12747+
"raw": "{{URL}}/resourceBookings?fields=id,startDate,endDate,billingAccountId,workPeriods&billingAccountId=80000071&workPeriods.isFirstWeek=true",
12748+
"host": [
12749+
"{{URL}}"
12750+
],
12751+
"path": [
12752+
"resourceBookings"
12753+
],
12754+
"query": [
12755+
{
12756+
"key": "fields",
12757+
"value": "id,startDate,endDate,billingAccountId,workPeriods"
12758+
},
12759+
{
12760+
"key": "billingAccountId",
12761+
"value": "80000071"
12762+
},
12763+
{
12764+
"key": "workPeriods.isFirstWeek",
12765+
"value": "true"
12766+
}
12767+
]
12768+
}
12769+
},
12770+
"response": []
12771+
},
12772+
{
12773+
"name": "search resource bookings with parameters 17",
12774+
"event": [
12775+
{
12776+
"listen": "test",
12777+
"script": {
12778+
"exec": [
12779+
"pm.test('Status code is 400', function () {\r",
12780+
" pm.response.to.have.status(400);\r",
12781+
" const response = pm.response.json()\r",
12782+
" pm.expect(response.message).to.eq(\"Cannot filter by both \\\"isFirstWeek\\\" and \\\"isLastWeek\\\" set to \\\"true\\\"\")\r",
1273112783
"});"
1273212784
],
1273312785
"type": "text/javascript"

src/services/ResourceBookingService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ searchResourceBookings.schema = Joi.object().keys({
893893
is: Joi.exist(),
894894
then: Joi.boolean().default(false),
895895
otherwise: Joi.boolean().valid(false).messages({
896-
'any.only': 'Cannot set "isFirstWeek" without "startDate"'
896+
'any.only': 'Cannot filter by "isFirstWeek" without "startDate"'
897897
})
898898
}),
899899
'workPeriods.isLastWeek': Joi.boolean().when(Joi.ref('workPeriods.startDate', { separator: false }), {
@@ -902,11 +902,11 @@ searchResourceBookings.schema = Joi.object().keys({
902902
is: false,
903903
then: Joi.boolean().default(false),
904904
otherwise: Joi.boolean().valid(false).messages({
905-
'any.only': 'Cannot set both "isFirstWeek" and "isLastWeek" to "true"'
905+
'any.only': 'Cannot filter by both "isFirstWeek" and "isLastWeek" set to "true"'
906906
})
907907
}),
908908
otherwise: Joi.boolean().valid(false).messages({
909-
'any.only': 'Cannot set "isFirstWeek" without "startDate"'
909+
'any.only': 'Cannot filter by "isLastWeek" without "startDate"'
910910
})
911911
}),
912912
'workPeriods.payments.status': Joi.workPeriodPaymentStatus(),

0 commit comments

Comments
 (0)