WaibuDb

WaibuDb class definition.

Constructor

new WaibuDb()

Constructor.

Members

adminMenu

Build menu for WaibuAdmin

config :TConfig

Configuration object.

Type:

methodMap :object

Method map for CRUD operations.

Type:
  • object
Properties
NameTypeAttributesDefaultDescription
createstring<optional>
'POST'

HTTP method for create operation

findstring<optional>
'GET'

HTTP method for find operation

getstring<optional>
'GET'

HTTP method for get operation

updatestring<optional>
'PUT'

HTTP method for update operation

removestring<optional>
'DELETE'

HTTP method for remove operation

Methods

(async) exportData(params) → {string}

Export data and save it as a file you can download later. This method is intended to be called by a worker process.

If sumba is loaded, file download is handled by sumba download management which provides you a slick UI to monitor the download progress and status.

If not, file is saved in standard bajo download directory.

Parameters:
NameTypeDescription
paramsobject
Returns:

Path to the exported file

Type: 
string

getAutoModels() → {Array}

Get all models that will be automatically included in the WaibuAdmin menu.

Returns:

List of models

Type: 
Array

(async) getLookupData(opts) → {Promise.<Array.<object>>}

Get lookup data for a specific model and field based on provided options.

Parameters:
NameTypeDescription
optsobject

Options for the lookup

Properties
NameTypeAttributesDefaultDescription
modelstring

Model name

reqobject

Request object

dataArray.<object>

Data array

idstring<optional>
'id'

ID field name

fieldstring

Field name to lookup

queryobject<optional>

Optional query object

Returns:

Lookup results

Type: 
Promise.<Array.<object>>

getParams(req, …items) → {object}

Collect all available parameters from the request object.

Parameters:
NameTypeAttributesDescription
reqobject

Request object

itemsstring<repeatable>

List of parameter names

Returns:

Collected parameters

Type: 
object