Remove unnecessary console logs from utility and schema files for cleaner code. Update index definitions for consistency in filament and printer profile schemas.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-07-23 21:44:40 +01:00
parent aad49bfcfd
commit e80022513f
6 changed files with 17 additions and 26 deletions

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

@ -154,10 +154,7 @@ const filamentProfileSchema = new mongoose.Schema(
{ timestamps: true }
);
filamentProfileSchema.index({
name: 'text',
filamentNotes: 'text',
});
filamentProfileSchema.index({ name: 'text', filamentNotes: 'text' });
filamentProfileSchema.virtual('id').get(function () {
return this._id;
@ -165,7 +162,4 @@ filamentProfileSchema.virtual('id').get(function () {
filamentProfileSchema.set('toJSON', { virtuals: true });
export const filamentProfileModel = mongoose.model(
'filamentProfile',
filamentProfileSchema
);
export const filamentProfileModel = mongoose.model('filamentProfile', filamentProfileSchema);

View File

@ -24,10 +24,19 @@ const bedExcludeAreaSchema = new mongoose.Schema(
const extruderSchema = new mongoose.Schema(
{
defaultNozzleVolumeType: { type: String },
nozzleDiameter: { type: Number },
nozzleVolume: { type: Number },
nozzleType: { type: String },
nozzleFlushDataset: { type: String },
minLayerHeight: { type: Number },
maxLayerHeight: { type: Number },
extruderColour: { type: String },
extruderType: { type: String },
extruderVariantList: { type: String },
extruderPrintableHeight: { type: Number },
printerExtruderId: { type: String },
printerExtruderVariant: { type: String },
positionOffsetX: { type: Number },
positionOffsetY: { type: Number },
retractionLength: { type: Number },
@ -48,7 +57,8 @@ const extruderSchema = new mongoose.Schema(
zHopOnlyLiftZBelow: { type: Number },
materialSwitchRetractionLength: { type: Number },
materialSwitchExtraLengthOnRestart: { type: Number },
longRetractionWhenCut: { type: Boolean }
longRetractionWhenCut: { type: Boolean },
retractionDistancesWhenCut: { type: Number },
},
{ _id: true }
);
@ -85,15 +95,12 @@ const printerProfileSchema = new mongoose.Schema(
machineUnloadFilamentTime: { type: Number },
thumbnails: [thumbnailSchema],
auxiliaryFan: { type: Boolean },
machineMaxJunctionDeviation: minMaxNumberSchema
machineMaxJunctionDeviation: minMaxNumberSchema,
},
{ timestamps: true }
);
printerProfileSchema.index({
name: 'text',
printerNotes: 'text'
});
printerProfileSchema.index({ name: 'text', printerNotes: 'text' });
printerProfileSchema.virtual('id').get(function () {
return this._id;
@ -101,7 +108,4 @@ printerProfileSchema.virtual('id').get(function () {
printerProfileSchema.set('toJSON', { virtuals: true });
export const printerProfileModel = mongoose.model(
'printerProfile',
printerProfileSchema
);
export const printerProfileModel = mongoose.model('printerProfile', printerProfileSchema);

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

@ -107,7 +107,7 @@ export class UpdateManager {
`Filtered ${eventName} event: ${formatTraceData({
objectType,
filter: normalizedFilter,
value,
value
})}`
);
return;

View File

@ -27,8 +27,6 @@ export async function generateHostOTP(id) {
auditLog: false
});
console.log('otpHost', otpHost);
return otpHost;
}