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

This commit is contained in:
Tom Butcher 2026-07-23 21:44:32 +01:00
parent 82ca27756d
commit a42f953e9a
9 changed files with 0 additions and 20 deletions

View File

@ -629,12 +629,9 @@ export const listObjectsByProperties = async ({
// If no properties specified, just return all objects without grouping
// Ensure pipeline is not empty by adding a $match stage if needed
if (pipeline.length === 0 && Object.keys(masterFilter).length === 0) {
console.log('Adding empty match stage');
pipeline.push({ $match: {} });
}
console.log('Running pipeline:', pipeline);
const results = await model.aggregate(pipeline);
console.log('Results:', results);
return results;
}
} catch (error) {

View File

@ -100,10 +100,6 @@ filamentStockSchema.statics.recalculate = async function (filamentStock, user) {
const startingGross = filamentStock.startingWeight?.gross ?? 0;
const gross = startingNet > 0 ? (startingGross * net) / startingNet : net;
console.log('Recalculating filament stock');
console.log('events', events);
console.log('filamentStock', filamentStock);
await editObject({
model: this,
id: filamentStock._id,

View File

@ -43,7 +43,6 @@ marketplaceSchema.statics.recalculate = async function (marketplace, user) {
} else {
stateType = 'ready';
}
console.log('recalculating marketplace state', stateType);
marketplace.state = { type: stateType };
await editObject({
model: this,

View File

@ -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)) {
return null;
}

View File

@ -153,7 +153,6 @@ export const getUserHistoryRouteHandler = async (req, res) => {
};
export const setAppPasswordRouteHandler = async (req, res) => {
console.log(req.user);
if (req.user._id.toString() !== req.params.id) {
return res
.status(403)

View File

@ -91,7 +91,6 @@ export async function createSlicerSession(user) {
expiresAt,
source: 'slicer',
};
console.log('sessionData', sessionData);
const userId = sessionData.user?._id;
if (!userId) {

View File

@ -51,7 +51,6 @@ const SLICER_VERSION = {
export const slicerUIRouteHandler = async (req, res) => {
try {
const { printerId } = req.params;
console.log('req.user', req.user);
const session = await createSlicerSession(req.user);
const authCode = await createSlicerAuthCode(session);
const uiUrl = new URL('/slicer', config.app.urlClient);

View File

@ -95,7 +95,6 @@ export const getPrinterRouteHandler = async (req, res) => {
],
});
if (result?.error) {
console.log('result', result.error);
logger.warn(`Printer not found with supplied id.`);
return res.status(result.code).send(result);
}

View File

@ -694,8 +694,6 @@ async function editAuditLog(oldValue, newValue, parentId, parentType, user) {
operation: 'edit',
});
console.log('auditLog', oldValue);
await auditLog.save();
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 });
for (const userNotifier of userNotifiers) {
await createNotification(userNotifier.user._id, title, message, type, metadata);
console.log('userNotifier.email', userNotifier.email);
if (userNotifier.email == true) {
console.log('sending email');
await sendEmailNotification(userNotifier.user, title, message, type, metadata);
}
}