28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
|
|
import "./_env";
|
||
|
|
import { getAdminPocketBase } from "../src/lib/server/pocketbase-admin";
|
||
|
|
|
||
|
|
async function main() {
|
||
|
|
const pb = await getAdminPocketBase();
|
||
|
|
const rods = await pb.collection("stock_items").getList(1, 3, {
|
||
|
|
filter: 'location = "NSS Fasteners price list - threaded rod DIN975/6, 1m (Hi-Tensile 8.8 + Mild Steel 4.8)"',
|
||
|
|
sort: "sku",
|
||
|
|
});
|
||
|
|
const total = await pb.collection("stock_items").getList(1, 1, {
|
||
|
|
filter: 'location = "NSS Fasteners price list - threaded rod DIN975/6, 1m (Hi-Tensile 8.8 + Mild Steel 4.8)"',
|
||
|
|
});
|
||
|
|
console.log(`THREADED RODS imported rows in PB: ${total.totalItems}\n`);
|
||
|
|
for (const r of rods.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, 140)));
|
||
|
|
console.log("name == description? " + (r.name === r.description ? "YES ✓" : "NO ✗"));
|
||
|
|
console.log("");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
main().catch((e) => {
|
||
|
|
console.error(e);
|
||
|
|
process.exit(1);
|
||
|
|
});
|