Fixed product SKUs.
Some checks failed
farmcontrol/farmcontrol-api/pipeline/head There was a failure building this commit

This commit is contained in:
Tom Butcher 2026-06-20 22:27:21 +01:00
parent bec68488a7
commit fd636c6c82
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { generateId } from '../../utils.js';
const { Schema } = mongoose; const { Schema } = mongoose;
const partSkuUsageSchema = new Schema({ const partSkuUsageSchema = new Schema({
part: { type: Schema.Types.ObjectId, ref: 'part', required: true },
partSku: { type: Schema.Types.ObjectId, ref: 'partSku', required: true }, partSku: { type: Schema.Types.ObjectId, ref: 'partSku', required: true },
quantity: { type: Number, required: true }, quantity: { type: Number, required: true },
}); });

View File

@ -35,7 +35,7 @@ export const listProductSkusRouteHandler = async (
search, search,
sort, sort,
order, order,
populate: ['priceTaxRate', 'costTaxRate'], populate: ['priceTaxRate', 'costTaxRate', 'product'],
}); });
if (result?.error) { if (result?.error) {
@ -83,6 +83,8 @@ export const getProductSkuRouteHandler = async (req, res) => {
'priceTaxRate', 'priceTaxRate',
'costTaxRate', 'costTaxRate',
'parts.partSku', 'parts.partSku',
'parts.part',
'product',
], ],
}); });
if (result?.error) { if (result?.error) {