Skip to content

Commit

Permalink
Remove link from new grant. Make link optional in the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
carletex committed Feb 26, 2024
1 parent df5db68 commit f003c09
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/nextjs/app/api/grants/new/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ type ReqBody = {
title?: string;
description?: string;
askAmount?: string;
link?: string;
signature?: `0x${string}`;
signer?: string;
};

// TODO: We could also add extra validtion of nonce
export async function POST(req: Request) {
try {
const { title, description, askAmount, link = "", signature, signer } = (await req.json()) as ReqBody;
const { title, description, askAmount, signature, signer } = (await req.json()) as ReqBody;

if (!title || !description || !askAmount || isNaN(Number(askAmount)) || !signature || !signer) {
return NextResponse.json({ error: "Invalid form details submited" }, { status: 400 });
Expand Down Expand Up @@ -45,7 +44,6 @@ export async function POST(req: Request) {
description: description,
askAmount: Number(askAmount),
builder: signer,
link: link,
});

return NextResponse.json({ grant }, { status: 201 });
Expand Down
5 changes: 1 addition & 4 deletions packages/nextjs/services/database/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ export type GrantData = {
description: string;
askAmount: number;
builder: string;
link: string;
link?: string;
timestamp: number;
// TODO Check if firebase has it bydefault
// updated timestamp;
// proposed and submited timestamp are imp
status: "proposed" | "approved" | "submitted" | "completed" | "rejected";
};

Expand Down

0 comments on commit f003c09

Please sign in to comment.