Skip to content

Commit ac39e18

Browse files
committed
Atualização MedCheck
1 parent 8d2fb27 commit ac39e18

File tree

72 files changed

+18276
-357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+18276
-357
lines changed

.browserslistrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
<!-- Sobre o projeto -->
2-
## Sobre o projeto
3-
Descrição do projeto...
1+
# ProjetoMeanSolo
42

5-
### Desenvolvido com
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.6.
64

7-
* [NodeJs](https://nodejs.org/en/)
8-
* [Angular](https://angular.io/)
9-
* [Bootstrap](https://getbootstrap.com)
5+
## Development server
106

11-
<!-- Alunos -->
12-
## Alunos
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
138

14-
1. André Levi Neri Longo
15-
2. Felipe Alves Ribeiro Sagi
16-
3. Gabriel Venancio Campaner
17-
4. Gabriela Lima Duarte
18-
5. Italo Martins de Araujo
19-
6. Leonardo Rodrigues
20-
7. Marcelo Ribeiro Mantana Júnior
21-
8. Vitor Rubio Gracia Dio
9+
## Code scaffolding
2210

23-
Link do projeto: [https://github.com/vitordio/MedCheckUSJT/settings/access](https://github.com/vitordio/MedCheckUSJT/settings/access)
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

angular.json

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"projeto-mean-solo": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:application": {
10+
"strict": true
11+
}
12+
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "dist/projeto-mean-solo",
21+
"index": "src/index.html",
22+
"main": "src/main.ts",
23+
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "tsconfig.app.json",
25+
"aot": true,
26+
"assets": [
27+
"src/favicon.ico",
28+
"src/assets"
29+
],
30+
"styles": [
31+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
32+
"src/styles.css"
33+
],
34+
"scripts": []
35+
},
36+
"configurations": {
37+
"production": {
38+
"fileReplacements": [
39+
{
40+
"replace": "src/environments/environment.ts",
41+
"with": "src/environments/environment.prod.ts"
42+
}
43+
],
44+
"optimization": true,
45+
"outputHashing": "all",
46+
"sourceMap": false,
47+
"namedChunks": false,
48+
"extractLicenses": true,
49+
"vendorChunk": false,
50+
"buildOptimizer": true,
51+
"budgets": [
52+
{
53+
"type": "initial",
54+
"maximumWarning": "500kb",
55+
"maximumError": "1mb"
56+
},
57+
{
58+
"type": "anyComponentStyle",
59+
"maximumWarning": "2kb",
60+
"maximumError": "4kb"
61+
}
62+
]
63+
}
64+
}
65+
},
66+
"serve": {
67+
"builder": "@angular-devkit/build-angular:dev-server",
68+
"options": {
69+
"browserTarget": "projeto-mean-solo:build"
70+
},
71+
"configurations": {
72+
"production": {
73+
"browserTarget": "projeto-mean-solo:build:production"
74+
}
75+
}
76+
},
77+
"extract-i18n": {
78+
"builder": "@angular-devkit/build-angular:extract-i18n",
79+
"options": {
80+
"browserTarget": "projeto-mean-solo:build"
81+
}
82+
},
83+
"test": {
84+
"builder": "@angular-devkit/build-angular:karma",
85+
"options": {
86+
"main": "src/test.ts",
87+
"polyfills": "src/polyfills.ts",
88+
"tsConfig": "tsconfig.spec.json",
89+
"karmaConfig": "karma.conf.js",
90+
"assets": [
91+
"src/favicon.ico",
92+
"src/assets"
93+
],
94+
"styles": [
95+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
96+
"src/styles.css"
97+
],
98+
"scripts": []
99+
}
100+
},
101+
"lint": {
102+
"builder": "@angular-devkit/build-angular:tslint",
103+
"options": {
104+
"tsConfig": [
105+
"tsconfig.app.json",
106+
"tsconfig.spec.json",
107+
"e2e/tsconfig.json"
108+
],
109+
"exclude": [
110+
"**/node_modules/**"
111+
]
112+
}
113+
},
114+
"e2e": {
115+
"builder": "@angular-devkit/build-angular:protractor",
116+
"options": {
117+
"protractorConfig": "e2e/protractor.conf.js",
118+
"devServerTarget": "projeto-mean-solo:serve"
119+
},
120+
"configurations": {
121+
"production": {
122+
"devServerTarget": "projeto-mean-solo:serve:production"
123+
}
124+
}
125+
}
126+
}
127+
}
128+
},
129+
"defaultProject": "projeto-mean-solo"
130+
}

backend/app.js

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
require('dotenv').config();
21
const express = require('express');
3-
42
const app = express();
5-
app.use(express.json());
6-
7-
// Acessando as variáveis de ambiente
8-
const dbUser = process.env.MONGODB_USER;
9-
const dbPassword = process.env.MONGODB_PASSWORD;
10-
const dbCluster = process.env.MONGODB_CLUSTER;
11-
const dbName = process.env.MONGODB_DATABASE;
3+
const mongoose = require('mongoose');
4+
const pacienteRoutes = require('./routes/pacientes');
5+
const usuarioRoutes = require ('./routes/usuarios');
126

13-
// Instanciando os Objetos
14-
const Medico = require('./models/medico');
15-
const Paciente = require('./models/paciente');
16-
const Familiar = require('./models/familiar');
17-
const Status = require('./models/status')
187

19-
// Importando as rotas definidas para o paciente
20-
const pacienteRoutes = require('./routes/paciente');
8+
app.use(express.json());
219

22-
const mongoose = require('mongoose');
23-
mongoose.connect(`mongodb+srv://${dbUser}:${dbPassword}@${dbCluster}.vhzwx.mongodb.net/${dbName}?retryWrites=true&w=majority`)
24-
.then(() => {
25-
console.log('Conexão OK');
10+
mongoose.connect('mongodb+srv://dbteste2:senha@cluster0.f86ri.mongodb.net/myFirstDatabase?retryWrites=true&w=majority').then(() => {
11+
console.log("Conexão realizada com sucesso.")
2612
}).catch(() => {
27-
console.log('Conexão NOK');
13+
console.log("Conexao não realizada.")
2814
})
2915

30-
app.use ((req, res, next) => {
16+
app.use((req, res, next) => {
3117
res.setHeader('Access-Control-Allow-Origin', "*");
32-
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type,Accept');
33-
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE,OPTIONS');
18+
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type,Accept, Authorization');
19+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS');
3420
next();
3521
});
3622

37-
app.use('/pacientes/', pacienteRoutes);
23+
app.use('/api/pacientes', pacienteRoutes);
24+
app.use('/api/usuarios', usuarioRoutes);
25+
26+
27+
module.exports = app;

backend/middleware/check-auth.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const jwt = require('jsonwebtoken');
2+
3+
module.exports = (req, res, next) => {
4+
try {
5+
const token = req.headers.autorizathion.split("")[1];
6+
const tokenDecodificado = jwt.verify(token, "minhasenha");
7+
req.dadosUsuario = {
8+
cpfUsuario: tokenDecodificado.cpfUsuario,
9+
idUsuario: tokenDecodificado.idUsuario
10+
}
11+
next()
12+
} catch (err) {
13+
res.status(401).json({
14+
mensagem: "Problemas com o token. Autenticação não realizada."
15+
})
16+
}
17+
}

backend/models/paciente.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
const mongoose = require('mongoose');
2+
//definindo o "schema"
23

34
const pacienteSchema = mongoose.Schema({
4-
nome: { type: String, required: true },
5-
cpf: { type: String, required: true },
6-
leito: { type: String, required: true },
7-
data_internacao: { type: Date, required: true },
8-
data_alta: { type: Date, required: false }
9-
})
5+
nomePaciente: { type: String, required: true },
6+
cpfPaciente: { type: String, required: true },
7+
idadePaciente: {type:Date, required:true},
8+
leito: { type: String, required: true },
9+
data_internacao: { type: Date, required: true },
10+
data_alta: { type: Date, required: false },
11+
senha: { type: String, required: true }
12+
});
13+
//criamos o modelo associado ao nome paciente e exportamos
14+
//tornando acessível para outros módulos da aplicação
15+
module.exports = mongoose.model('Paciente', pacienteSchema);
1016

11-
module.exports = mongoose.model('Paciente', pacienteSchema);

backend/models/status.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
const mongoose = require('mongoose');
22

3+
// definindo o schema
34
const statusSchema = mongoose.Schema({
4-
idPaciente: {
5-
type: Schema.types.ObjectId,
6-
ref: 'Paciente'
7-
},
8-
temperatura: { type: String, required: true },
9-
pressaoArterial: { type: String, required: true },
10-
nivelGravidade: { type: String, required: true },
11-
problemasRespiratorios: { type: Boolean, required: true },
12-
possuiCansaco: { type: Boolean, required: true },
13-
alimentandoBem: { type: Boolean, required: true },
5+
idPaciente: {
6+
type: Schema.types.ObjectId,
7+
ref: 'Paciente'
8+
},
9+
temperatura: { type: String, required: true },
10+
pressao: { type: String, required: true },
11+
nivelEvolucao: { type: String, required: true },
12+
problemasRespiratorios: { type: Boolean, required: true },
13+
cansaco: { type: Boolean, required: true },
14+
alimentacao: { type: Boolean, required: true },
15+
observacao: { type: String, required: false }
1416
})
15-
16-
module.exports = mongoose.model('Status', statusSchema);
17+
//criamos o modelo associado ao nome Medico e exportamos
18+
//tornando acessível para outros módulos da aplicação
19+
module.exports = mongoose.model('Status', statusSchema);

backend/models/usuario.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const mongoose = require('mongoose');
2+
const uniqueValidator = require('mongoose-unique-validator');
3+
const usuarioSchema = mongoose.Schema({
4+
nomeUsuario: { type: String, required: true, unique: true },
5+
idadeUsuario: { type: Date, required: true },
6+
cpfUsuario: { type: String, required: true },
7+
funcional: { type: String, required: true },
8+
telefone: { type: String, required: true },
9+
password: { type: String, required: true }
10+
});
11+
usuarioSchema.plugin(uniqueValidator);
12+
module.exports = mongoose.model("Usuario", usuarioSchema);

0 commit comments

Comments
 (0)