logging
parent
c1804a3663
commit
a662087197
|
@ -190,7 +190,7 @@ export async function CheckoutCanceled(req: Request, res: Response) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (userPendingPayment === null) {
|
if (userPendingPayment === null) {
|
||||||
console.log("CheckoutCanceled not found");
|
logger.error("CheckoutCanceled: user pending payment not found");
|
||||||
return res.status(400).send({ err: "invalid request" });
|
return res.status(400).send({ err: "invalid request" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,6 @@ export async function AddEmployee(req: Request, res: Response) {
|
||||||
if (email !== undefined && email.length > 0) {
|
if (email !== undefined && email.length > 0) {
|
||||||
email = email.toLowerCase();
|
email = email.toLowerCase();
|
||||||
|
|
||||||
console.log("email", email);
|
|
||||||
|
|
||||||
if (!(await isEmailValid(email))) {
|
if (!(await isEmailValid(email))) {
|
||||||
return res.status(400).send({ err: "invalid request" });
|
return res.status(400).send({ err: "invalid request" });
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,35 +26,3 @@ sequelize
|
||||||
});
|
});
|
||||||
|
|
||||||
export default sequelize;
|
export default sequelize;
|
||||||
|
|
||||||
/*
|
|
||||||
export let sequelize: Sequelize;
|
|
||||||
|
|
||||||
export function initDatabase() {
|
|
||||||
sequelize = new Sequelize(
|
|
||||||
process.env.MARIADB_DATABASE as string,
|
|
||||||
process.env.MARIADB_USER as string,
|
|
||||||
process.env.MARIADB_PASSWORD as string,
|
|
||||||
{
|
|
||||||
host: process.env.MARIADB_HOST as string,
|
|
||||||
port: Number(process.env.MARIADB_PORT),
|
|
||||||
dialect: "mariadb",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
sequelize
|
|
||||||
.authenticate()
|
|
||||||
.then(() => {
|
|
||||||
logger.info("Connection has been established successfully.");
|
|
||||||
})
|
|
||||||
.catch((err: Error) => {
|
|
||||||
console.error("Unable to connect to the database:", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function syncDatabase() {
|
|
||||||
sequelize.sync({ force: true }).then(() => {
|
|
||||||
console.log(`Database & tables created!`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import amqplib from "amqplib";
|
import amqplib from "amqplib";
|
||||||
|
import logger from "../logger/logger";
|
||||||
|
|
||||||
let channel: amqplib.Channel;
|
let channel: amqplib.Channel;
|
||||||
|
|
||||||
|
@ -13,14 +14,14 @@ async function connect(
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!open) {
|
if (!open) {
|
||||||
console.log("⚡️[RabbitMQ]: connection failed");
|
logger.error("⚡️[RabbitMQ]: connection failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel = await open.createChannel();
|
channel = await open.createChannel();
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
console.log("⚡️[RabbitMQ]: channel failed");
|
logger.error("⚡️[RabbitMQ]: channel not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +33,7 @@ async function sendEmail(
|
||||||
bodyData: any
|
bodyData: any
|
||||||
) {
|
) {
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
console.log("⚡️[RabbitMQ]: channel not available");
|
logger.error("⚡️[RabbitMQ]: channel not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue