Refactored a bunch of shit
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m57s
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m57s
This commit is contained in:
@@ -6,6 +6,7 @@ import { nanoid } from "nanoid";
|
||||
import {
|
||||
validateTimeEntryResources,
|
||||
validateTimeRange,
|
||||
MAX_LENGTHS,
|
||||
} from "../../../lib/validation";
|
||||
|
||||
export const POST: APIRoute = async ({ request, locals }) => {
|
||||
@@ -27,6 +28,13 @@ export const POST: APIRoute = async ({ request, locals }) => {
|
||||
});
|
||||
}
|
||||
|
||||
if (description && description.length > MAX_LENGTHS.description) {
|
||||
return new Response(
|
||||
JSON.stringify({ error: `Description must be ${MAX_LENGTHS.description} characters or fewer` }),
|
||||
{ status: 400, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
}
|
||||
|
||||
if (!startTime) {
|
||||
return new Response(JSON.stringify({ error: "Start time is required" }), {
|
||||
status: 400,
|
||||
|
||||
Reference in New Issue
Block a user