Skip to content

Commit

Permalink
Validation on backend
Browse files Browse the repository at this point in the history
  • Loading branch information
carletex committed Apr 17, 2024
1 parent 55af4fd commit feb4626
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/nextjs/app/api/grants/new/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export async function POST(req: Request) {
try {
const { title, description, signature, signer } = (await req.json()) as ReqBody;

if (!title || !description || !signature || !signer) {
return NextResponse.json({ error: "Invalid form details submited" }, { status: 400 });
if (!title || !description || !signature || !signer || description.length > 750 || title.length > 50) {
return NextResponse.json({ error: "Invalid form details submitted" }, { status: 400 });
}

// Verif if the builder is present
const builder = await findUserByAddress(signer);
if (!builder.exists) {
return NextResponse.json({ error: "Only buidlguild builders can submit for grants" }, { status: 401 });
return NextResponse.json({ error: "Only Buidlguidl builders can submit for grants" }, { status: 401 });
}

const recoveredAddress = await recoverTypedDataAddress({
Expand Down

0 comments on commit feb4626

Please sign in to comment.