Update stock audit level schema to require tags and improve code readability
This commit modifies the `stockAuditLevel` schema by making the `tags` field required, ensuring that all stock audit levels have associated tags for better categorization. Additionally, it enhances the readability of the `normalizeAuditLevelLine` function by adjusting the formatting of the item and itemSku assignments, improving overall code clarity.
This commit is contained in:
parent
bce40ce30d
commit
6623bf9bfd
@ -13,8 +13,8 @@ const toId = (value) => {
|
||||
export function normalizeAuditLevelLine(line) {
|
||||
const allItems = Boolean(line?.allItems);
|
||||
const allSkus = allItems ? true : Boolean(line?.allSkus);
|
||||
const item = allItems ? null : line?.item?._id ?? line?.item ?? null;
|
||||
const itemSku = allItems || allSkus ? null : line?.itemSku?._id ?? line?.itemSku ?? null;
|
||||
const item = allItems ? null : (line?.item?._id ?? line?.item ?? null);
|
||||
const itemSku = allItems || allSkus ? null : (line?.itemSku?._id ?? line?.itemSku ?? null);
|
||||
|
||||
return {
|
||||
_id: line?._id,
|
||||
@ -62,7 +62,7 @@ const stockAuditLevelSchema = new Schema(
|
||||
{
|
||||
_reference: { type: String, default: () => generateId()() },
|
||||
name: { type: String, required: true },
|
||||
tags: [{ type: String }],
|
||||
tags: [{ type: String, required: true }],
|
||||
auditLines: { type: [stockAuditLevelLineSchema], default: [] },
|
||||
},
|
||||
{ timestamps: true }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user