Removed console.log statements across various files to clean up the code and improve performance. This includes logging related to audit logs, user notifications, database operations, and session management.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
This commit is contained in:
parent
82ca27756d
commit
a42f953e9a
@ -629,12 +629,9 @@ export const listObjectsByProperties = async ({
|
|||||||
// If no properties specified, just return all objects without grouping
|
// If no properties specified, just return all objects without grouping
|
||||||
// Ensure pipeline is not empty by adding a $match stage if needed
|
// Ensure pipeline is not empty by adding a $match stage if needed
|
||||||
if (pipeline.length === 0 && Object.keys(masterFilter).length === 0) {
|
if (pipeline.length === 0 && Object.keys(masterFilter).length === 0) {
|
||||||
console.log('Adding empty match stage');
|
|
||||||
pipeline.push({ $match: {} });
|
pipeline.push({ $match: {} });
|
||||||
}
|
}
|
||||||
console.log('Running pipeline:', pipeline);
|
|
||||||
const results = await model.aggregate(pipeline);
|
const results = await model.aggregate(pipeline);
|
||||||
console.log('Results:', results);
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -100,10 +100,6 @@ filamentStockSchema.statics.recalculate = async function (filamentStock, user) {
|
|||||||
const startingGross = filamentStock.startingWeight?.gross ?? 0;
|
const startingGross = filamentStock.startingWeight?.gross ?? 0;
|
||||||
const gross = startingNet > 0 ? (startingGross * net) / startingNet : net;
|
const gross = startingNet > 0 ? (startingGross * net) / startingNet : net;
|
||||||
|
|
||||||
console.log('Recalculating filament stock');
|
|
||||||
console.log('events', events);
|
|
||||||
console.log('filamentStock', filamentStock);
|
|
||||||
|
|
||||||
await editObject({
|
await editObject({
|
||||||
model: this,
|
model: this,
|
||||||
id: filamentStock._id,
|
id: filamentStock._id,
|
||||||
|
|||||||
@ -43,7 +43,6 @@ marketplaceSchema.statics.recalculate = async function (marketplace, user) {
|
|||||||
} else {
|
} else {
|
||||||
stateType = 'ready';
|
stateType = 'ready';
|
||||||
}
|
}
|
||||||
console.log('recalculating marketplace state', stateType);
|
|
||||||
marketplace.state = { type: stateType };
|
marketplace.state = { type: stateType };
|
||||||
await editObject({
|
await editObject({
|
||||||
model: this,
|
model: this,
|
||||||
|
|||||||
@ -162,10 +162,6 @@ export async function makeRequest({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data != null) {
|
|
||||||
console.log('DATA: ' + JSON.stringify(data, null, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok && acceptableStatuses.includes(response.status)) {
|
if (!response.ok && acceptableStatuses.includes(response.status)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,6 @@ export const getUserHistoryRouteHandler = async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const setAppPasswordRouteHandler = async (req, res) => {
|
export const setAppPasswordRouteHandler = async (req, res) => {
|
||||||
console.log(req.user);
|
|
||||||
if (req.user._id.toString() !== req.params.id) {
|
if (req.user._id.toString() !== req.params.id) {
|
||||||
return res
|
return res
|
||||||
.status(403)
|
.status(403)
|
||||||
|
|||||||
@ -91,7 +91,6 @@ export async function createSlicerSession(user) {
|
|||||||
expiresAt,
|
expiresAt,
|
||||||
source: 'slicer',
|
source: 'slicer',
|
||||||
};
|
};
|
||||||
console.log('sessionData', sessionData);
|
|
||||||
const userId = sessionData.user?._id;
|
const userId = sessionData.user?._id;
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
|
|||||||
@ -51,7 +51,6 @@ const SLICER_VERSION = {
|
|||||||
export const slicerUIRouteHandler = async (req, res) => {
|
export const slicerUIRouteHandler = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { printerId } = req.params;
|
const { printerId } = req.params;
|
||||||
console.log('req.user', req.user);
|
|
||||||
const session = await createSlicerSession(req.user);
|
const session = await createSlicerSession(req.user);
|
||||||
const authCode = await createSlicerAuthCode(session);
|
const authCode = await createSlicerAuthCode(session);
|
||||||
const uiUrl = new URL('/slicer', config.app.urlClient);
|
const uiUrl = new URL('/slicer', config.app.urlClient);
|
||||||
|
|||||||
@ -95,7 +95,6 @@ export const getPrinterRouteHandler = async (req, res) => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
console.log('result', result.error);
|
|
||||||
logger.warn(`Printer not found with supplied id.`);
|
logger.warn(`Printer not found with supplied id.`);
|
||||||
return res.status(result.code).send(result);
|
return res.status(result.code).send(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -694,8 +694,6 @@ async function editAuditLog(oldValue, newValue, parentId, parentType, user) {
|
|||||||
operation: 'edit',
|
operation: 'edit',
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('auditLog', oldValue);
|
|
||||||
|
|
||||||
await auditLog.save();
|
await auditLog.save();
|
||||||
|
|
||||||
await distributeNew(auditLog, 'auditLog');
|
await distributeNew(auditLog, 'auditLog');
|
||||||
@ -925,9 +923,7 @@ async function notfiyObjectUserNotifiers(id, objectType, title, message, type =
|
|||||||
const userNotifiers = await userNotifierModel.find({ object: id, objectType: objectType });
|
const userNotifiers = await userNotifierModel.find({ object: id, objectType: objectType });
|
||||||
for (const userNotifier of userNotifiers) {
|
for (const userNotifier of userNotifiers) {
|
||||||
await createNotification(userNotifier.user._id, title, message, type, metadata);
|
await createNotification(userNotifier.user._id, title, message, type, metadata);
|
||||||
console.log('userNotifier.email', userNotifier.email);
|
|
||||||
if (userNotifier.email == true) {
|
if (userNotifier.email == true) {
|
||||||
console.log('sending email');
|
|
||||||
await sendEmailNotification(userNotifier.user, title, message, type, metadata);
|
await sendEmailNotification(userNotifier.user, title, message, type, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user