You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.7 KiB
70 lines
1.7 KiB
module.exports = function (pName, pLabel, pIcon, pDesc) {
|
|
return {
|
|
name: pName,
|
|
label: pLabel || pName,
|
|
icon: pIcon || 'mdi-hexagon',
|
|
description: pDesc || '---',
|
|
/** MongoDB indexes - format: {keys:, options:} */
|
|
indexes: [],
|
|
/** JSON Schema */
|
|
schema: {},
|
|
hooks: {
|
|
read: {
|
|
before: (pCtx, next) => {
|
|
next()
|
|
},
|
|
after: (pCtx, docs, next) => {
|
|
next()
|
|
}
|
|
},
|
|
readOne: {
|
|
before: (pCtx, id, next) => {
|
|
next()
|
|
},
|
|
after: (pCtx, doc, next) => {
|
|
next()
|
|
}
|
|
},
|
|
update: {
|
|
before: (pCtx, id, doc, origin, next) => {
|
|
next()
|
|
},
|
|
after: (pCtx, doc, origin, next) => {
|
|
next()
|
|
}
|
|
},
|
|
create: {
|
|
before: (pCtx, doc, next) => {
|
|
next()
|
|
},
|
|
after: (pCtx, doc, next) => {
|
|
next()
|
|
}
|
|
},
|
|
delete: {
|
|
before: (pCtx, id, next) => {
|
|
next()
|
|
},
|
|
after: (pCtx, ok, next) => {
|
|
next()
|
|
}
|
|
}
|
|
},
|
|
tools: {},
|
|
/** Db handler of collection */
|
|
__db: null,
|
|
__services: {
|
|
read: function (pArgs, pCallback) { pCallback() },
|
|
readOne: function (pId, pArgs, pCallback) { pCallback() },
|
|
create: function (pDoc, pUser, pCallback) { pCallback() },
|
|
update: function (pId, pDoc, pUser, pCallback) { pCallback() },
|
|
delete: function (pId, pUser, pCallback) { pCallback() }
|
|
},
|
|
__internal: {
|
|
router: require('express').Router(),
|
|
addRoute: function (pMethod, pUrl, pFunc) {
|
|
this.router[pMethod.toLowerCase()](pUrl, pFunc)
|
|
}
|
|
}
|
|
}
|
|
}
|