submission date time fix

This commit is contained in:
makearmy 2025-09-22 15:34:20 -04:00
parent 709417c25d
commit e08891c94b

View file

@ -175,17 +175,21 @@ export async function POST(req: Request) {
screen_id = up.id;
}
// Repeaters
// Repeaters (pass through; UI already coerces numbers/bools)
const fills = Array.isArray(body?.fill_settings) ? body.fill_settings : [];
const lines = Array.isArray(body?.line_settings) ? body.line_settings : [];
const rasters = Array.isArray(body?.raster_settings) ? body.raster_settings : [];
// (numbers coerced in your UI; keep as-is here)
// timestamps for required fields
const nowIso = new Date().toISOString();
const payload: Record<string, any> = {
setting_title,
uploader,
setting_notes,
submission_date: new Date().toISOString(),
submission_date: nowIso, // required by your schema
last_modified_date: nowIso, // ← add this to satisfy required rule
photo: photo_id,
screen: screen_id ?? null,
@ -205,7 +209,7 @@ export async function POST(req: Request) {
status: "pending",
submitted_via: "makearmy-app",
submitted_at: new Date().toISOString(),
submitted_at: nowIso,
};
if (target === "settings_fiber") {