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

179 lines
5.0 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"
},
"locker": {
"type" : "number"
},
"fi": {
"type" : "string"
},
"birth": {
"type" : "date"
},
"isF11Allowed": {
"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"
}
},
"scopes":{
"summary": {
"include": [
{
"relation": "user",
"scope": {
"fields": ["email", "name", "nickname", "roleFk"],
"include": [
{
"relation": "role",
"scope": {
"fields": ["name"]
}
},
{
"relation": "emailUser",
"scope": {
"fields": ["email"]
}
}
]
}
}, {
"relation": "department",
"scope": {
"include": {
"relation": "department"
}
}
}, {
"relation": "boss"
}, {
"relation": "client",
"scope": {
"fields": [
"id",
"name",
"fi",
"socialName",
"contact",
"street",
"city",
"postcode",
"email",
"mobile",
"isActive",
"credit",
"creditInsurance",
"iban",
"dueDay",
"isEqualizated",
"isFreezed",
"hasToInvoiceByAddress",
"hasToInvoice",
"isToBeMailed",
"hasSepaVnl",
"hasLcr",
"hasCoreVnl",
"hasCoreVnh",
"hasIncoterms",
"isTaxDataChecked",
"eypbc",
"quality",
"isVies",
"isRelevant",
"accountingAccount",
"created",
"sageTaxTypeFk",
"sageTransactionTypeFk",
"businessTypeFk",
"salesPersonFk",
"hasElectronicInvoice",
"rating",
"recommendedCredit"
]
}
}, {
"relation": "sip"
}
]
}
}
}