feat: enhance donation creation logging and adjust amount limits
- Add detailed secure logging throughout the donation creation API route for production debugging, including request receipt, validation results, amount calculations, PIX creation success, and error handling - Update custom donation amount schema to allow minimum 0.01 and maximum 100,000 for broader donation flexibility - Modify secure logger to always output data in production for improved monitoring and troubleshooting
This commit is contained in:
1 parent
d05fbe967e
commit
e30d9493ff
4 files changed
+58
-12
No files matched your search
@@ -75,8 +75,8 @@ export const donationTierSchema = z.enum(
|
||||
// Schema para valor customizado
|
||||
export const customAmountSchema = z
|
||||
.number()
|
||||
.min(5, "Valor mínimo é R$ 5,00")
|
||||
.max(500, "Valor máximo é R$ 500,00");
|
||||
.min(0.01, "Valor mínimo é R$ 0,01")
|
||||
.max(100000, "Valor máximo é R$ 100.000,00");
|
||||
|
||||
// Schema completo para criação de doação
|
||||
export const createDonationSchema = z
|
||||
@@ -116,12 +116,12 @@ export const createDonationSchema = z
|
||||
(data) => {
|
||||
// Se tier for custom, customAmount deve estar no range válido
|
||||
if (data.tier === "custom" && data.customAmount) {
|
||||
return data.customAmount >= 5 && data.customAmount <= 500;
|
||||
return data.customAmount >= 0.01 && data.customAmount <= 100000;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
{
|
||||
message: "Valor deve estar entre R$ 5,00 e R$ 500,00",
|
||||
message: "Valor deve estar entre R$ 0,01 e R$ 100.000,00",
|
||||
path: ["customAmount"],
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user