Closed
Description
- Add
duration
field toJob
andResourceBooking
models. This field would define the duration in weeks. - This field is optional and should contain an integer value equal or greater than
1
- add Joi validation. - As we already have
startDate
andendDate
fields we should keep all of these 3 fields consistent. If 2 of these fields are defined, we should automatically calculate the third one.- start + duration => calculate end
- end + duration => calculate start
- start + end => calculate duration (we should validate that calculated
duration
is more than 1 and it's an integer value or throw validation error). - start + end + duration => check if (end - start = duration) and if no, then throw validation error because data is inconsistent.
- please, create some reusable logic for this, could it be done on the Model level if it makes sense so we never forget to add it?
- Update Swagger and Postman
- Update ES Processor
- Create migration script
- Mention which requests to call to update ES mapping