8032-devToTest_2440 #3009
|
@ -0,0 +1,4 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('WorkerTimeControlMail', 'count', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Worker', '__get__mail', 'READ', 'ALLOW', 'ROLE', 'hr');
|
|
@ -1,3 +0,0 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('WorkerTimeControlMail', 'getWeeklyMail', 'READ', 'ALLOW', 'ROLE', '$owner');
|
|
@ -1,34 +0,0 @@
|
|||
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,4 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/worker-time-control-mail/checkInbox')(Self);
|
||||
require('../methods/worker-time-control-mail/getWeeklyMail')(Self);
|
||||
};
|
||||
|
|
|
@ -32,13 +32,5 @@
|
|||
"sendedCounter": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"model": "VnUser",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
},
|
||||
"acls": []
|
||||
}
|
||||
}
|
|
@ -116,11 +116,6 @@
|
|||
"model": "Locker",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"medicalReview": {
|
||||
"type": "hasMany",
|
||||
"model": "MedicalReview",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"incomes": {
|
||||
"type": "hasMany",
|
||||
"model": "WorkerIncome",
|
||||
|
@ -130,6 +125,11 @@
|
|||
"type": "hasMany",
|
||||
"model": "TrainingCourse",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"mail": {
|
||||
"type": "hasMany",
|
||||
"model": "WorkerTimeControlMail",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
@ -139,60 +139,13 @@
|
|||
"permission": "ALLOW",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$owner"
|
||||
},
|
||||
{
|
||||
"property": "__get__mail",
|
||||
"accessType": "READ",
|
||||
"permission": "ALLOW",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$owner"
|
||||
}
|
||||
],
|
||||
"scopes": {
|
||||
"descriptor": {
|
||||
"fields": [
|
||||
"id",
|
||||
"phone"
|
||||
],
|
||||
"include": [
|
||||
{
|
||||
"relation": "user",
|
||||
"scope": {
|
||||
"fields": [
|
||||
"name",
|
||||
"nickname"
|
||||
],
|
||||
"include": {
|
||||
"relation": "emailUser",
|
||||
"scope": {
|
||||
"fields": [
|
||||
"email"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"relation": "department",
|
||||
"scope": {
|
||||
"fields": [
|
||||
"departmentFk"
|
||||
],
|
||||
"include": [
|
||||
{
|
||||
"relation": "department",
|
||||
"scope": {
|
||||
"fields": [
|
||||
"id",
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"relation": "sip",
|
||||
"scope": {
|
||||
"fields": [
|
||||
"extension"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue