Skip to content

Commit

Permalink
feat: WIP, adds ability to create lowering w/o end (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcschwartzman authored Apr 26, 2024
1 parent 5debd80 commit 9d0584c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions routes/api/v1/lowerings.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const loweringCreatePayload = Joi.object({
id: Joi.string().length(24).optional(),
lowering_id: Joi.string().required(),
start_ts: Joi.date().iso().required(),
stop_ts: Joi.date().iso().required(),
stop_ts: Joi.date().iso().optional(),
lowering_additional_meta: Joi.object().required(),
lowering_tags: Joi.array().items(loweringTag).required(),
lowering_location: Joi.string().allow('').required(),
Expand Down Expand Up @@ -740,7 +740,12 @@ exports.plugin = {

// Validate date strings
lowering.start_ts = new Date(request.payload.start_ts);
lowering.stop_ts = new Date(request.payload.stop_ts);
if (lowering.stop_ts) {
lowering.stop_ts = new Date(request.payload.stop_ts);
}
else {
console.log("NO LOWERING STOP TIMESTAMP");
}

if (lowering.start_ts >= lowering.stop_ts) {
return Boom.badRequest('Start date must be older than stop date');
Expand Down

0 comments on commit 9d0584c

Please sign in to comment.