cost and price
This commit is contained in:
@@ -176,6 +176,7 @@ export async function bootstrapAppData() {
|
||||
isSellable: false,
|
||||
isPurchasable: true,
|
||||
defaultCost: 42.5,
|
||||
defaultPrice: null,
|
||||
notes: "Primary sheet stock for enclosure fabrication.",
|
||||
},
|
||||
});
|
||||
@@ -191,6 +192,7 @@ export async function bootstrapAppData() {
|
||||
isSellable: false,
|
||||
isPurchasable: true,
|
||||
defaultCost: 0.18,
|
||||
defaultPrice: null,
|
||||
notes: "Bulk hardware item.",
|
||||
},
|
||||
});
|
||||
@@ -206,6 +208,7 @@ export async function bootstrapAppData() {
|
||||
isSellable: true,
|
||||
isPurchasable: false,
|
||||
defaultCost: 118,
|
||||
defaultPrice: 249,
|
||||
notes: "Starter BOM for the inventory foundation slice.",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -37,6 +37,7 @@ const inventoryItemSchema = z.object({
|
||||
isSellable: z.boolean(),
|
||||
isPurchasable: z.boolean(),
|
||||
defaultCost: z.number().nonnegative().nullable(),
|
||||
defaultPrice: z.number().nonnegative().nullable(),
|
||||
notes: z.string(),
|
||||
bomLines: z.array(bomLineSchema),
|
||||
});
|
||||
|
||||
@@ -45,6 +45,7 @@ type InventoryDetailRecord = {
|
||||
isSellable: boolean;
|
||||
isPurchasable: boolean;
|
||||
defaultCost: number | null;
|
||||
defaultPrice: number | null;
|
||||
notes: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
@@ -220,6 +221,7 @@ function mapDetail(record: InventoryDetailRecord): InventoryItemDetailDto {
|
||||
}),
|
||||
description: record.description,
|
||||
defaultCost: record.defaultCost,
|
||||
defaultPrice: record.defaultPrice,
|
||||
notes: record.notes,
|
||||
createdAt: record.createdAt.toISOString(),
|
||||
bomLines: record.bomLines.slice().sort((a, b) => a.position - b.position).map(mapBomLine),
|
||||
@@ -371,6 +373,7 @@ export async function listInventoryItemOptions() {
|
||||
id: true,
|
||||
sku: true,
|
||||
name: true,
|
||||
defaultPrice: true,
|
||||
},
|
||||
orderBy: [{ sku: "asc" }],
|
||||
});
|
||||
@@ -379,6 +382,7 @@ export async function listInventoryItemOptions() {
|
||||
id: item.id,
|
||||
sku: item.sku,
|
||||
name: item.name,
|
||||
defaultPrice: item.defaultPrice,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -517,6 +521,7 @@ export async function createInventoryItem(payload: InventoryItemInput) {
|
||||
isSellable: payload.isSellable,
|
||||
isPurchasable: payload.isPurchasable,
|
||||
defaultCost: payload.defaultCost,
|
||||
defaultPrice: payload.defaultPrice,
|
||||
notes: payload.notes,
|
||||
bomLines: validatedBom.bomLines.length
|
||||
? {
|
||||
@@ -558,6 +563,7 @@ export async function updateInventoryItem(itemId: string, payload: InventoryItem
|
||||
isSellable: payload.isSellable,
|
||||
isPurchasable: payload.isPurchasable,
|
||||
defaultCost: payload.defaultCost,
|
||||
defaultPrice: payload.defaultPrice,
|
||||
notes: payload.notes,
|
||||
bomLines: {
|
||||
deleteMany: {},
|
||||
|
||||
Reference in New Issue
Block a user