Skip to content

Commit

Permalink
logs to api/contributions
Browse files Browse the repository at this point in the history
  • Loading branch information
estevamfurtado committed Nov 1, 2024
1 parent e03a1db commit a8d15e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pages/api/contributions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ async function runCreateContribution(
req: DIContainerNextApiRequest,
res: NextApiResponse
) {
// TODO: remove log
console.log("> runCreateContribution()", req.body);

const prismaClient: PrismaClient = req.scope.resolve("dbClient");
const validator = CreateContributionSchema.destruct();
const [err, args] = validator(req.body);

if (!err && args) {
let birthday: Date | undefined = new Date(args.dob);
if (!isValidBirthday(birthday)[0]) {
Expand Down Expand Up @@ -144,6 +148,9 @@ async function runCreateContribution(
});
mail(args.customer.email, args.customer.name);
} catch (e) {
// TODO: remove log
console.log(">> error", e);

const err = e as any;
mailError(args.customer.email, err);
if (err.response.status === 400) {
Expand Down

0 comments on commit a8d15e5

Please sign in to comment.