salix/modules/worker/back/models/worker.json

320 lines
8.6 KiB
JSON

{
"name": "Worker",
"description": "Company employees",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "worker"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"firstName": {
"type": "string",
"required": true
},
"lastName": {
"type": "string",
"required": true
},
"phone": {
"type": "string"
},
"bossFk": {
"type": "number"
},
"maritalStatus": {
"type": "string"
},
"originCountryFk": {
"type": "number"
},
"educationLevelFk": {
"type": "number"
},
"SSN": {
"type": "string"
},
"mobileExtension": {
"type": "number"
},
"code": {
"type": "string",
"required": true
},
"fi": {
"type": "string"
},
"birth": {
"type": "date"
},
"sex": {
"type": "string"
},
"isFreelance": {
"type": "boolean"
},
"fiDueDate": {
"type": "date"
},
"hasMachineryAuthorized": {
"type": "boolean"
},
"seniority": {
"type": "date"
},
"isDisable": {
"type": "boolean"
},
"isSsDiscounted": {
"type": "boolean"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "id"
},
"boss": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "bossFk"
},
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "id"
},
"sip": {
"type": "belongsTo",
"model": "Sip",
"foreignKey": "id"
},
"department": {
"type": "belongsTo",
"model": "WorkerDepartment",
"foreignKey": "id"
},
"collegues": {
"type": "hasMany",
"model": "WorkerTeamCollegues",
"foreignKey": "workerFk"
},
"locker": {
"type": "hasMany",
"model": "Locker",
"foreignKey": "workerFk"
},
"medicalReview": {
"type": "hasMany",
"model": "MedicalReview",
"foreignKey": "workerFk"
},
"incomes": {
"type": "hasMany",
"model": "WorkerIncome",
"foreignKey": "workerFk"
},
"trainingCourse": {
"type": "hasMany",
"model": "TrainingCourse",
"foreignKey": "workerFk"
},
"mail": {
"type": "hasMany",
"model": "WorkerTimeControlMail",
"foreignKey": "workerFk"
}
},
"acls": [
{
"property": "__get__locker",
"accessType": "READ",
"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"
]
}
}
]
},
"summary": {
"fields": [
"id",
"firstName",
"lastName",
"bossFk",
"sex",
"phone",
"mobileExtension"
],
"include": [
{
"relation": "user",
"scope": {
"fields": [
"name",
"nickname",
"roleFk"
],
"include": [
{
"relation": "role",
"scope": {
"fields": [
"name"
]
}
},
{
"relation": "emailUser",
"scope": {
"fields": [
"email"
]
}
}
]
}
},
{
"relation": "department",
"scope": {
"include": {
"relation": "department",
"scope": {
"fields": [
"name"
]
}
}
}
},
{
"relation": "boss",
"scope": {
"fields": [
"id",
"name"
]
}
},
{
"relation": "client",
"scope": {
"fields": [
"id"
]
}
},
{
"relation": "sip",
"scope": {
"include": {
"relation": "queueMember",
"scope": {
"fields": [
"queue",
"extension"
]
}
}
}
}
]
},
"advancedSummary": {
"fields": [
"id",
"fiDueDate",
"seniority",
"fi",
"isFreelance",
"isSsDiscounted",
"hasMachineryAuthorized",
"isDisable",
"birth",
"educationLevelFk",
"originCountryFk",
"maritalStatus",
"SSN"
],
"include": [
{
"relation": "client",
"scope": {
"fields": [
"id",
"phone"
]
}
}
]
}
}
}