Skip to content

Validate shocks POST inputs and default priceShift server-side#5

Merged
ghostleek merged 2 commits intofix/prodfrom
copilot/sub-pr-1-yet-again
Mar 10, 2026
Merged

Validate shocks POST inputs and default priceShift server-side#5
ghostleek merged 2 commits intofix/prodfrom
copilot/sub-pr-1-yet-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 10, 2026

When priceShift was omitted by the client, it passed undefined directly into the SQL insert, causing a NOT NULL constraint violation and a 500. type and description were also unvalidated, silently inserting nulls or garbage.

Changes

  • Input validationtype and description must be non-empty strings; returns 400 with a descriptive message if either fails
  • priceShift default — falls back to 10 server-side when the client omits it or sends a non-finite value (NaN, Infinity)
if (typeof type !== 'string' || type.trim().length === 0) {
  return NextResponse.json({ error: 'type is required and must be a non-empty string' }, { status: 400 });
}
if (typeof description !== 'string' || description.trim().length === 0) {
  return NextResponse.json({ error: 'description is required and must be a non-empty string' }, { status: 400 });
}

const shift = typeof priceShift === 'number' && isFinite(priceShift) ? priceShift : 10;

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
live-game Error Error Mar 10, 2026 5:32am

…ks POST route

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on sessions API and UI fixes Validate shocks POST inputs and default priceShift server-side Mar 10, 2026
@ghostleek ghostleek marked this pull request as ready for review March 10, 2026 05:36
@ghostleek ghostleek merged commit b482eaa into fix/prod Mar 10, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants