fix(api): validate timestamps when creating events and allow setting a location
This commit is contained in:
parent
2d7196211f
commit
19e07d9980
2 changed files with 31 additions and 1 deletions
|
@ -397,6 +397,12 @@ export const PATCH = auth(async (req, { params }) => {
|
|||
}
|
||||
updateData.end_time = endTimeValidation.getTime().toString();
|
||||
}
|
||||
if (new Date(start_time) >= new Date(end_time)) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: 'start_time must be before end_time' },
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
if (location) updateData.location = location;
|
||||
if (status) {
|
||||
const validStatuses = ['TENTATIVE', 'CONFIRMED', 'CANCELLED'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue