first commit

This commit is contained in:
2026-07-16 20:48:43 -03:00
commit 5696cee264
1111 changed files with 322270 additions and 0 deletions
@@ -0,0 +1,77 @@
export type ErrorReportParams = {
message: string;
url: string;
userName: string;
userEmail: string;
userId: string;
dateError: Date;
};
class ErrorReporting {
constructor() {
}
/**
* Adds an error to the queue to be reported later.
* In development, it logs the error to the console instead.
* @param data The error details.
*/
public report(data: ErrorReportParams): void {
//if (process.env.NODE_ENV !== "production") {
console.log("--- ERROR REPORT (DEV) ---", data, "\n");
//return;
//}
//this.errorQueue.push(data);
}
/*
private async sendErrorQueue(): Promise<void> {
if (this.errorQueue.length === 0) {
return;
}
// Copy the current queue and clear it immediately
const errorsToSend = [...this.errorQueue];
this.errorQueue = [];
const formattedErrors = errorsToSend
.map(
(error) =>
`----------------------------------------\n` +
`Message: ${error.message}\n` +
`URL: ${error.url}\n` +
`User: ${error.userName} - ${error.userEmail} - ${error.userId}\n` +
`Date: ${error.dateError.toISOString()}`
)
.join("\n\n");
const message =
`Se han acumulado ${errorsToSend.length} errores desde el último reporte.\n\n` +
formattedErrors;
try {
await NotificationsManager.sendEmail({
email: "info@turnosxpress.com.ar",
subject: `Reporte de Errores (${errorsToSend.length}) en turnosXpress`,
message: message,
});
console.log(
`[ErrorReporting] Successfully sent a report with ${errorsToSend.length} errors.`
);
} catch (emailError) {
console.error(
"[ErrorReporting] Failed to send error report email. Errors will be re-queued.",
emailError
);
// If sending fails, add the errors back to the front of the queue to be retried.
this.errorQueue.unshift(...errorsToSend);
}
}
*/
}
const ErrorReportingManager = new ErrorReporting();
export { ErrorReportingManager };