Commit e9f5cc45 authored by Bruno Meyer's avatar Bruno Meyer 😢

#23: Add Professor model

parent 684d6268
......@@ -18,7 +18,7 @@
* **owner** ROLE have all EXECUTE, READ and WRITE operations
- Relations
* Belongs to : **Bloco** as `blocoCod`
* Has and Belongs To Many : **Recursodesala** as `recursos`
* Has and Belongs To Many : **Recursodesala**
* Belongs to : **Tipodesala** as `tipo`
* Belongs to : **Secretario** as `ownerId`
......@@ -53,7 +53,7 @@
- Relations
* This model have a self-realtion. To implement this, we use the EquivalenciaDisciplina model
* Has Many : **Turma** `Required (in Turma)` as `disciplinaId (in Turma)`
* Has and Belongs To Many : **Recursodesala** as `recursosnecessarios`
* Has and Belongs To Many : **Recursodesala**
* Belongs To : **Tipodesala** as `tipodesalaId`
* Belongs To : **Departamento** as `departamentoCod`
......@@ -97,6 +97,7 @@
* **admin** ROLE have all EXECUTE, READ and WRITE operations
- Relations
* Belongs To : **Departamento** as `departamentoCod`
* Belongs To : **Disciplina** as `disciplinaCod`
## Recursodesala
- Public: `False`
......@@ -160,14 +161,17 @@
- Relations
* Belongs To : **Bloco** as `blocoCod`
* Belongs To : **Setor** as `setorCod`
* Has and Belongs To Many : **Setor** as `Disciplina`
* Has and Belongs To Many : **Disciplina**
- Observation: The relation with Bloco means that one Curso will be relationed
with a Bloco.
## Departamento
- Public: `True`
- Description: This model extend `Orgao`
- Attributes
- Attributes `idInjection`=`false`
* nome : **string** `Required`
* codigo : **string** `Required`, `id`
* _id : **number** `generated`
- ACLs
* All permissions not specified is `DENY`
* **admin** ROLE have all EXECUTE, READ and WRITE operations
......@@ -203,4 +207,17 @@
* **admin** ROLE have all EXECUTE, READ and WRITE operations
- Relations
* Has Many : **Orgao** as `secretarioId`
* Has Many : **Sala** as `ownerId`
\ No newline at end of file
* Has Many : **Sala** as `ownerId`
## Professor
- Public: `True`
- Attributes `idInjection`=`false`
* nome : **string** `Required`
* codigo : **string** `Required`, `id`
* _id : **number** `generated`
- ACLs
* All permissions not specified is `DENY`
* **admin** ROLE have all EXECUTE, READ and WRITE operations
- Relations
* Belongs To : **Departamento** as `departamentoCod`
* Has and Belongs To Many : **Turma**
\ No newline at end of file
......@@ -2,11 +2,25 @@
"name": "Departamento",
"plural": "departamentos",
"base": "Orgao",
"idInjection": true,
"idInjection": false,
"options": {
"validateUpsert": true
},
"properties": {},
"properties": {
"nome": {
"type": "string",
"required": true
},
"codigo": {
"type": "string",
"id": true,
"required": true
},
"_id": {
"type": "number",
"generated": true
}
},
"validations": [],
"relations": {
"setor": {
......@@ -18,6 +32,11 @@
"type": "hasMany",
"model": "Turma",
"foreignKey": "departamentoCod"
},
"professores": {
"type": "hasMany",
"model": "Professor",
"foreignKey": "departamentoCod"
}
},
"acls": [
......
......@@ -45,7 +45,7 @@
"turmas": {
"type": "hasMany",
"model": "Turma",
"foreignKey": "disciplinaId",
"foreignKey": "disciplinaCod",
"required": true
},
"recursosnecessarios": {
......
......@@ -23,7 +23,9 @@ var models = [
'Setor',
'Departamento',
'Curso',
"CursoDisciplina"
"CursoDisciplina",
"Professor",
"ProfessorTurma"
];
/**
......
'use strict';
module.exports = function(Professor) {
};
{
"name": "Professor",
"plural": "professores",
"base": "PersistedModel",
"idInjection": false,
"options": {
"validateUpsert": true
},
"properties": {
"codigo": {
"type": "string",
"required": true,
"id": true
},
"nome": {
"type": "string",
"required": true
},
"website": {
"type": "string"
},
"email": {
"type": "string"
},
"_id": {
"type": "number",
"generated": true
}
},
"validations": [],
"relations": {
"departamento": {
"type": "belongsTo",
"model": "Departamento",
"foreignKey": "departamentoCod"
},
"turmas": {
"type": "hasAndBelongsToMany",
"model": "Turma"
}
},
"acls": [
{
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY",
"property": "*"
},
{
"principalType": "ROLE",
"principalId": "admin",
"permission": "ALLOW",
"property": "*"
}
],
"methods": {}
}
......@@ -16,8 +16,8 @@
},
"codigo": {
"type": "string",
"required": true,
"id": true
"id": true,
"required": true
},
"localizacao": {
"type": "geopoint",
......
'use strict';
module.exports = function(Turma) {
Turma.validatesPresenceOf('disciplinaId');
Turma.validatesPresenceOf('disciplinaCod');
};
......@@ -26,6 +26,11 @@
"type": "belongsTo",
"model": "Departamento",
"foreignKey": "departamentoCod"
},
"disciplina": {
"type": "belongsTo",
"model": "Disciplina",
"foreignKey": "disciplinaCod"
}
},
"acls": [
......
......@@ -87,5 +87,9 @@
"Curso": {
"dataSource": "ensalamento",
"public": true
},
"Professor": {
"dataSource": "ensalamento",
"public": true
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment