Skip to content

Commit 96ef522

Browse files
Merge pull request #46 from eisbilir/dev
make Resource Booking index to not store time, only dates
2 parents 9761368 + e7c3c6b commit 96ef522

File tree

5 files changed

+47
-6
lines changed

5 files changed

+47
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ coverage
55
.DS_Store
66
.env
77
api.env
8+
.eslintrc.y*ml

src/scripts/createIndex.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ async function createIndex () {
6363
userId: { type: 'keyword' },
6464
jobId: { type: 'keyword' },
6565
status: { type: 'keyword' },
66-
startDate: { type: 'date' },
67-
endDate: { type: 'date' },
66+
startDate: { type: 'date', format: 'yyyy-MM-dd' },
67+
endDate: { type: 'date', format: 'yyyy-MM-dd' },
6868
memberRate: { type: 'float' },
6969
customerRate: { type: 'float' },
7070
rateType: { type: 'keyword' },

src/services/ResourceBookingProcessorService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ processCreate.schema = {
3737
projectId: Joi.number().integer().required(),
3838
userId: Joi.string().uuid().required(),
3939
jobId: Joi.string().uuid().allow(null),
40-
startDate: Joi.date().allow(null),
41-
endDate: Joi.date().allow(null),
40+
startDate: Joi.string().regex(/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/).allow(null),
41+
endDate: Joi.string().regex(/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/).allow(null),
4242
memberRate: Joi.number().allow(null),
4343
customerRate: Joi.number().allow(null),
4444
rateType: Joi.rateType().required(),
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
{"topic":"taas.resourcebooking.create","originator":"taas-api","timestamp":"2020-11-05T19:00:25.038Z","mime-type":"application/json","payload":{"projectId":21,"userId":"a55fe1bc-1754-45fa-9adc-cf3d6d7c377a","jobId":"ffbc24f7-301e-48d3-bf01-c056916056a2","startDate":"2020-09-27T04:17:23.131Z","endDate":"2020-09-27T04:17:23.131Z","memberRate":13.23,"customerRate":13,"rateType":"hourly","id":"60d97713-8621-476e-b006-7cb9589c7777","createdAt":"2020-11-05T19:00:23.036Z","createdBy":"a55fe1bc-1754-45fa-9adc-cf3d6d7c377a","status":"assigned"}}
1+
{
2+
"topic": "taas.resourcebooking.create",
3+
"originator": "taas-api",
4+
"timestamp": "2020-11-05T19:00:25.038Z",
5+
"mime-type": "application/json",
6+
"payload": {
7+
"projectId": 21,
8+
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
9+
"jobId": "ffbc24f7-301e-48d3-bf01-c056916056a2",
10+
"startDate": "2020-09-27",
11+
"endDate": "2020-09-27",
12+
"memberRate": 13.23,
13+
"customerRate": 13,
14+
"rateType": "hourly",
15+
"id": "60d97713-8621-476e-b006-7cb9589c7777",
16+
"createdAt": "2020-11-05T19:00:23.036Z",
17+
"createdBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
18+
"status": "assigned"
19+
}
20+
}
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
{"topic":"taas.resourcebooking.update","originator":"taas-api","timestamp":"2020-11-05T19:00:26.407Z","mime-type":"application/json","payload":{"id":"60d97713-8621-476e-b006-7cb9589c7777","projectId":21,"userId":"a55fe1bc-1754-45fa-9adc-cf3d6d7c377a","jobId":"ffbc24f7-301e-48d3-bf01-c056916056a2","startDate":"2020-09-27T04:17:23.131Z","endDate":"2020-09-27T04:17:23.131Z","memberRate":13.23,"customerRate":13,"rateType":"hourly","status":"assigned","updatedAt":"2020-11-05T19:00:25.062Z","updatedBy":"a55fe1bc-1754-45fa-9adc-cf3d6d7c377a","createdAt":"2020-11-05T19:00:16.268Z","createdBy":"a55fe1bc-1754-45fa-9adc-cf3d6d7c377a"}}
1+
{
2+
"topic": "taas.resourcebooking.update",
3+
"originator": "taas-api",
4+
"timestamp": "2020-11-05T19:00:26.407Z",
5+
"mime-type": "application/json",
6+
"payload": {
7+
"id": "60d97713-8621-476e-b006-7cb9589c7777",
8+
"projectId": 21,
9+
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
10+
"jobId": "ffbc24f7-301e-48d3-bf01-c056916056a2",
11+
"startDate": "2020-09-27",
12+
"endDate": "2020-09-27",
13+
"memberRate": 13.23,
14+
"customerRate": 13,
15+
"rateType": "hourly",
16+
"status": "assigned",
17+
"updatedAt": "2020-11-05T19:00:25.062Z",
18+
"updatedBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
19+
"createdAt": "2020-11-05T19:00:16.268Z",
20+
"createdBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a"
21+
}
22+
}

0 commit comments

Comments
 (0)