[dyad] Corrected typo in PocketBase suppliers schema - wrote 3 file(s)

This commit is contained in:
[dyad] 2025-09-12 13:37:56 +02:00
parent 29b54417ef
commit ef32f7f080
3 changed files with 52 additions and 54 deletions

View file

@ -13,75 +13,71 @@ migrate((app) => {
"deleteRule": null,
"schema": [
{
"id": "supplier_id", // Unique ID for the 'id' field
"name": "id",
"type": "text",
"system": true,
"required": true,
"primaryKey": true,
"unique": true,
"autogeneratePattern": "[a-z0-9]{15}",
"hidden": false,
"id": "text3208210256",
"max": 15,
"min": 15,
"name": "id",
"pattern": "^[a-z0-9]+$",
"presentable": false,
"hidden": false
},
{
"id": "supplier_name", // Unique ID for the 'name' field
"name": "name",
"type": "text",
"system": false,
"primaryKey": true,
"required": true,
"presentable": true,
"unique": true,
"autogeneratePattern": "",
"max": 0,
"min": 0,
"pattern": "",
"hidden": false
"system": true,
"type": "text"
},
{
"id": "supplier_address", // Unique ID for the 'address' field
"name": "address",
"type": "text",
"system": false,
"required": false,
"presentable": false,
"unique": false,
"autogeneratePattern": "",
"hidden": false,
"id": "text2474346735",
"max": 0,
"min": 0,
"name": "supplier_name", // Corrected from 'supplier_name' to 'supplier_name'
"pattern": "",
"hidden": false
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"id": "supplier_phone", // Unique ID for the 'phone' field
"name": "phone",
"type": "text",
"system": false,
"required": false,
"presentable": false,
"unique": false,
"autogeneratePattern": "",
"hidden": false,
"id": "text4003876389",
"max": 0,
"min": 0,
"name": "supplier_address", // Corrected typo from 'suppier_address'
"pattern": "",
"hidden": false
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"id": "supplier_email", // Unique ID for the 'email' field
"name": "email",
"type": "text",
"system": false,
"required": false,
"exceptDomains": null,
"hidden": false,
"id": "email1049198174",
"name": "supplier_email",
"onlyDomains": null,
"presentable": false,
"unique": false,
"required": false,
"system": false,
"type": "email"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text23603970",
"max": 0,
"min": 0,
"name": "supplier_phone_number", // Corrected from 'supplier_phone'
"pattern": "",
"hidden": false
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"id": "supplier_created", // Unique ID for the 'created' field
@ -112,5 +108,7 @@ migrate((app) => {
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_suppliers");
// Revert changes if necessary, though typically migrations are forward-only.
// For simplicity, we'll just delete the collection on downgrade.
return app.delete(collection);
});

View file

@ -15,23 +15,23 @@ import {
export type Supplier = {
id: string
name: string
address: string
phone: string
name: string // This will map to supplier_name from PocketBase
address: string // This will map to supplier_address from PocketBase
phone: string // This will map to supplier_phone_number from PocketBase
email: string
}
export const columns: ColumnDef<Supplier>[] = [
{
accessorKey: "name",
accessorKey: "name", // Matches the 'name' property in the Supplier type
header: "Supplier Name",
},
{
accessorKey: "address",
accessorKey: "address", // Matches the 'address' property in the Supplier type
header: "Address",
},
{
accessorKey: "phone",
accessorKey: "phone", // Matches the 'phone' property in the Supplier type
header: "Phone",
},
{

View file

@ -27,10 +27,10 @@ const Suppliers = () => {
});
const formattedData: Supplier[] = records.items.map((item: any) => ({
id: item.id,
name: item.name,
address: item.address,
phone: item.phone,
email: item.email,
name: item.supplier_name, // Mapped to supplier_name from PocketBase
address: item.supplier_address, // Mapped to supplier_address from PocketBase
phone: item.supplier_phone_number, // Mapped to supplier_phone_number from PocketBase
email: item.supplier_email,
}));
setSuppliers(formattedData);
} catch (error) {