8032-devToTest_2440 #3009
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('WorkerTimeControlMail', 'getWeeklyMail', 'READ', 'ALLOW', 'ROLE', '$owner');
|
|
@ -0,0 +1,34 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getWeeklyMail', {
|
||||
description: 'Check an email inbox and process it',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
description: 'workerFk',
|
||||
required: true,
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'week',
|
||||
type: 'number',
|
||||
required: true
|
||||
}, {
|
||||
arg: 'year',
|
||||
type: 'number',
|
||||
required: true
|
||||
}],
|
||||
returns:
|
||||
{
|
||||
type: 'Object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:id/getWeeklyMail`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getWeeklyMail = async(workerFk, week, year) => {
|
||||
return Self.findOne({where: {workerFk, week, year}});
|
||||
};
|
||||
};
|
|
@ -1,3 +1,4 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/worker-time-control-mail/checkInbox')(Self);
|
||||
require('../methods/worker-time-control-mail/getWeeklyMail')(Self);
|
||||
};
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
"type": "number"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "employee",
|
||||
"permission": "ALLOW"
|
||||
"relations": {
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"model": "VnUser",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
]
|
||||
},
|
||||
"acls": []
|
||||
}
|
Loading…
Reference in New Issue