34 lines
1.8 KiB
JavaScript
34 lines
1.8 KiB
JavaScript
|
|
import PocketBase from "pocketbase";
|
||
|
|
const pb = new PocketBase("http://pocketbase-zinlbpsext2ro0lgb2558vfy.169.239.180.130.sslip.io");
|
||
|
|
await pb.admins.authWithPassword("David.els1@outlook.com", "1234567890");
|
||
|
|
|
||
|
|
// Look at full record of fp0001test0001
|
||
|
|
console.log("=== Full record fp0001test0001 ===");
|
||
|
|
const fp1 = await pb.collection("fuel_purchases").getOne("fp0001test0001");
|
||
|
|
console.log(JSON.stringify(fp1, null, 2));
|
||
|
|
|
||
|
|
console.log("\n=== Full record fp202602018500 ===");
|
||
|
|
const fp2 = await pb.collection("fuel_purchases").getOne("fp202602018500");
|
||
|
|
console.log(JSON.stringify(fp2, null, 2));
|
||
|
|
|
||
|
|
console.log("\n=== TEST customer pricing rules ===");
|
||
|
|
const rules = await pb.collection("customer_pricing").getFullList({ filter: 'customer = "vjeseis6bueukkk" || customer = "buildtestco001"', fields: "id,customer,year,month,price_per_litre,special_price" });
|
||
|
|
console.log(`Total: ${rules.length}`);
|
||
|
|
for (const r of rules) console.log(` ${r.id} cust=${r.customer} ${r.year}-${r.month} ${r.price_per_litre}`);
|
||
|
|
|
||
|
|
console.log("\n=== TEST customer details ===");
|
||
|
|
const test1 = await pb.collection("customers").getOne("vjeseis6bueukkk");
|
||
|
|
console.log("TEST:", JSON.stringify(test1, null, 2));
|
||
|
|
const test2 = await pb.collection("customers").getOne("buildtestco001");
|
||
|
|
console.log("Build Test Co:", JSON.stringify(test2, null, 2));
|
||
|
|
|
||
|
|
console.log("\n=== Suppliers: full data ===");
|
||
|
|
const sups = await pb.collection("suppliers").getFullList({ fields: "id,name,contact_number,email,vat_number,address", sort: "name" });
|
||
|
|
for (const s of sups) {
|
||
|
|
console.log(` ${s.id} "${s.name}"`);
|
||
|
|
console.log(` contact: ${s.contact_number || "—"}`);
|
||
|
|
console.log(` email: ${s.email || "—"}`);
|
||
|
|
console.log(` vat: ${s.vat_number || "—"}`);
|
||
|
|
console.log(` addr: ${s.address || "—"}`);
|
||
|
|
}
|