feat: enhance ComuniTable by adding nullable cap field
This commit is contained in:
parent
4f9a46d1d2
commit
572a5420c1
2 changed files with 80 additions and 67 deletions
|
|
@ -35,6 +35,7 @@ const handler = async (
|
||||||
const createCaller = t.createCallerFactory(appRouter);
|
const createCaller = t.createCallerFactory(appRouter);
|
||||||
const caller = createCaller(ctx);
|
const caller = createCaller(ctx);
|
||||||
|
|
||||||
|
try {
|
||||||
// Handle the event
|
// Handle the event
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "payment_intent.created": {
|
case "payment_intent.created": {
|
||||||
|
|
@ -45,7 +46,10 @@ const handler = async (
|
||||||
res.status(400).send("No metadata in payment intent");
|
res.status(400).send("No metadata in payment intent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!metadata.paymentId || !(typeof metadata.paymentId === "string")) {
|
if (
|
||||||
|
!metadata.paymentId ||
|
||||||
|
!(typeof metadata.paymentId === "string")
|
||||||
|
) {
|
||||||
res.status(400).send("No orderId or userId in metadata");
|
res.status(400).send("No orderId or userId in metadata");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +69,10 @@ const handler = async (
|
||||||
res.status(400).send("No metadata in payment intent");
|
res.status(400).send("No metadata in payment intent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!metadata.paymentId || !(typeof metadata.paymentId === "string")) {
|
if (
|
||||||
|
!metadata.paymentId ||
|
||||||
|
!(typeof metadata.paymentId === "string")
|
||||||
|
) {
|
||||||
res.status(400).send("No orderId or userId in metadata");
|
res.status(400).send("No orderId or userId in metadata");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +116,10 @@ const handler = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(200).json({ received: true });
|
res.status(200).json({ received: true });
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error handling webhook event:", error);
|
||||||
|
res.status(200).json({ received: true });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
res.setHeader("Allow", "POST");
|
res.setHeader("Allow", "POST");
|
||||||
res.status(405).end("Method Not Allowed");
|
res.status(405).end("Method Not Allowed");
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ export default interface ComuniTable {
|
||||||
sigla: ColumnType<string, string, string>;
|
sigla: ColumnType<string, string, string>;
|
||||||
|
|
||||||
catasto: ColumnType<string, string, string>;
|
catasto: ColumnType<string, string, string>;
|
||||||
|
|
||||||
|
cap: ColumnType<string | null, string | null, string | null>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Comuni = Selectable<ComuniTable>;
|
export type Comuni = Selectable<ComuniTable>;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue