pockettojs / pocketto

A CRUD tools that can easily manage your data offline with real time ability
https://pocketto.dev
MIT License
7 stars 2 forks source link

Model : create new instance by passing in Object #2

Closed WongYC-66 closed 1 day ago

WongYC-66 commented 2 days ago

Using example from pocketto_doc

Instead of this,

const invoice = new SalesInvoice();
invoice.invoiceNumber = 'INV-001';
invoice.customerName = 'John Doe';
invoice.remarks = 'This is a sample invoice.';
invoice.items = [
  { description: 'Item 1', quantity: 2, unitPrice: 100 },
  { description: 'Item 2', quantity: 3, unitPrice: 150 },
];

a proposal for declared model to create instance like this too

const invoice = new SalesInvoice({
    invoiceNumber = 'INV-001',
    customerName = 'John Doe',
    remarks = 'This is a sample invoice.',
    items = [
        { description: 'Item 1', quantity: 2, unitPrice: 100 },
        { description: 'Item 2', quantity: 3, unitPrice: 150 },
    ]
});
kentng201 commented 1 day ago

@WongYC-66 documentation added, can close