Function handlers for CRUD operations.

To use these handlers, import them and call them with the appropriate parameters like this:

const { importModule } = this.app.bajo
const listHandler = await importModule('waibuDb:/lib/crud/list-handler.js')
...

Methods

(async, static) listHandler(opts) → {Promise.<string>}

Handle the list view for a given model, rendering the appropriate template with the retrieved data.

Parameters:
NameTypeDescription
optsobject

Options object

Properties
NameTypeAttributesDefaultDescription
reqobject

Request object

replyobject

Reply object

modelstring

Model name

templatestring

Template path

paramsobject<optional>
{}

Parameters for the template

addOnsHandlerfunction<optional>

Add-ons handler function

templateDisabledstring<optional>
'waibuDb.template:/disabled.html'

Disabled template path

optionsobject<optional>
{}

Additional options

Returns:

Renders the list view

Type: 
Promise.<string>