mechanic-blueprint
v2.1.0
Published
```javascript // Data field for VIEW-based handlers // index, new, edit, sorting
Downloads
12
Keywords
Readme
// Data field for VIEW-based handlers
// index, new, edit, sorting
data: {
model: mongooseModel, // <required>
context: mongooseQuery || {mongooseQuery}, // <optional>
view: string // <optional>
}
// Data field for ACTION-based handlers
// create, update, delete, sorted
data: {
model: mongooseModel, // <required>
validation: mongooseModel.schemaValidation // <optional>
query: mongooseQuery, // <optional for create,sorted | required for update,delete>
version: string || [string], // <optional>
versionMsgField: string, // <optional>
redirectUrl: string, // <optional>
sortField: string, // <optional just for sorted>,
}
// Context Object
// mongooseQuery || {mongooseQuery}
// if it is constructed with just mongooseQuery
// it is automatically assigned to
// 1. record -> when in new, edit.
// 2. records -> when in index, sorting.
// Example Data: 1
{
context: Store
.find({store_mallid: request.params.mallid})
.populate("store_locations")
.sort("store_name")
}
// Example Data: 2
{
context: {
records: KioskSlider
.find({kiosk_slider_mallid: request.params.mallid})
.sort("kiosk_slider_order -createdAt"),
kiosks: Kiosk
.find({kiosk_mallid: request.params.mallid})
}
}
*/