WFDASH-WEBAPP/scripts/verify-nss-fix.ts
Dave d8e8714720 feat(stock): update pricing logic and transform script for fasteners
- Enhanced `nss-fasteners-pb-import.json` to compute `selling_price` as `cost_price * (1 + 80%)` and included `markup` in the records.
- Updated `nss-fasteners-pb-transform.ts` to allow configurable CSV and output file names via environment variables, improving flexibility for different product runs.
- Added support for uploading photos in the repair detail page, including validation for file types and sizes, and implemented a dialog for creating customer quotes linked to repairs.
- Introduced a new `customer_quote` field in the `Repair` type to link generated quotes back to their respective repairs.

These changes streamline the pricing process and enhance the user experience in managing repairs and quotes.
2026-09-21 12:32:44 +02:00

34 lines
1.3 KiB
TypeScript

import "./_env";
import { getAdminPocketBase } from "../src/lib/server/pocketbase-admin";
async function main() {
const pb = await getAdminPocketBase();
const rows = await pb.collection("stock_items").getList(1, 3, {
filter: 'location = "NSS Fasteners price list - hex nut DIN934 (Grade 8 + A2)"',
sort: "sku",
});
console.log("Sample rows after fix:\n");
for (const r of rows.items) {
console.log("SKU: " + r.sku);
console.log("name: " + JSON.stringify(r.name));
console.log("description:" + JSON.stringify(r.description));
console.log("notes: " + JSON.stringify(r.notes?.substring(0, 120) + (r.notes && r.notes.length > 120 ? "…" : "")));
console.log("name == description? " + (r.name === r.description ? "✓" : "✗"));
console.log("");
}
// Tally: how many rows now have name == description?
const allRows = await pb.collection("stock_items").getFullList<{ name: string; description: string }>({
filter: 'location = "NSS Fasteners price list - hex nut DIN934 (Grade 8 + A2)"',
fields: "name,description",
batch: 200,
});
const matching = allRows.filter((r) => r.name === r.description).length;
console.log(`Rows with name == description: ${matching}/${allRows.length}`);
}
main().catch((e) => {
console.error(e);
process.exit(1);
});