问题描述
我正试图使所有员工都从撇号的头脑中消失。我是cms和撇号的新手。当我在safeFilters中添加管理器时,出现TypeError错误:无法设置未定义的属性'safeFor'。但是,如果我删除管理器,它就可以正常工作。我尝试从邮递员执行的api是api/v1/Employees?manager=James
。我在做什么错了?
我的员工作品index.js是。
module.exports =
{
name: 'employee',extend: 'apostrophe-pieces',label: 'Employee',pluralLabel: 'Employees',restApi: {
maxPerPage: 50,safeFilters: [ 'firstName','lastName','manager']
},addFields:
[
{
name: 'title',label: 'Full Name',type: 'string',required: true,contextual: true
},{
name: 'firstName',label: 'First Name',required: true
},{
name: 'lastName',label: 'Last Name',{
name: 'body',label: 'Biography',type: 'area',options: {
widgets: {
'apostrophe-rich-text': {
toolbar: [ 'Bold','Italic','Link','Unlink' ]
},'apostrophe-images': {}
}
}
},{
name: 'manager',label: 'Manager',type: 'singleton',widgetType: 'employees',},{
name: 'phone',label: 'Phone',type: 'string'
},{
name: 'thumbnail',label: 'Thumbnail',widgetType: 'apostrophe-images',options: {
limit: 1,minSize: [ 200,200 ],aspectRatio: [ 1,1 ]
}
}
],arrangeFields:
[
{
name: 'contact',label: 'Contact',fields: [ 'firstName','phone','manager' ]
},{
name: 'admin',label: 'Administrative',fields: [ 'slug','published','tags' ]
},{
name: 'content',label: 'Biographical',fields: [ 'thumbnail','body' ]
}
],construct: function(self,options) {
self.beforeSave = function(req,piece,options,callback) {
piece.title = piece.firstName + ' ' + piece.lastName;
return callback();
};
}
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)