Miss any of our Open RFC calls?Watch the recordings here! »

mechanic-blueprint

2.0.0 • Public • Published
// 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})
    }
 }
 
*/
     

Keywords

none

Install

npm i mechanic-blueprint

DownloadsWeekly Downloads

1

Version

2.0.0

License

ISC

Last publish

Collaborators

  • avatar
  • avatar