Skip to content

Commit

Permalink
Versão 1.0.0 finalizada
Browse files Browse the repository at this point in the history
  • Loading branch information
gtjadsonsantos committed Feb 3, 2020
1 parent 6217ed7 commit 9192978
Show file tree
Hide file tree
Showing 777 changed files with 93,017 additions and 381 deletions.
20 changes: 16 additions & 4 deletions backend/controllers/RoomController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,31 @@ module.exports = {
},
async store (request, response) {
const sql = `
INSERT INTO Rooms (NumberRoom, NameImage ) VALUES ('${request.body.number_room}', '${request.body.name_image}');
INSERT INTO Rooms (
NumberRoom,
NameImage
) VALUES(
'${request.body.room}',
'${request.file.filename}');
`

await connection.query(sql,(err, results, fields)=>{
return response.json(results)
connection.query(` INSERT INTO Floors (NumberFloor, RoomsID ) VALUES( '${request.body.floor}','${results.insertId}');`,(err, results, fields)=>{
console.log(results)
})
})


},
async update (request, response) {

const sql = `
UPDATE Rooms SET
NumberRoom = '${request.body.NewNumberRoom}'
NameImage='${request.file.filename}'
WHERE
NumberRoom='${request.body.NumberRoom}'
NumberRoom='${request.body.room}';
`
console.log(sql)
await connection.query(sql,(err, results, fields)=>{
return response.json(results)
})
Expand Down
28 changes: 16 additions & 12 deletions backend/controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,31 @@ module.exports = {
await connection.query(sql,(err, results, fields)=>{
results.forEach(user => {
if (user.UserName == request.body.username && user.UserPassword == request.body.password ){
console.log(request.body.username)
console.log(user)
return response.json(user)
}
});
})
},
async indexAll (request,response) {
const sql = ` SELECT * FROM Users; `
await connection.query(sql,(err, results, fields)=>{
return response.json(results)
})
},
async store (request, response) {
const sql = `
INSERT INTO Users
(UserName,
UserPassword,
NameImage,
UrlImage)
UserPassword
)
VALUES (
'${request.body.username}',
'${request.body.password}',
'${request.body.name_image}',
'${request.body.url_image}');
'${request.body.password}'
);
`
console.log(sql)

await connection.query(sql,(err, results, fields)=>{
return response.json(results)

Expand All @@ -33,13 +39,11 @@ module.exports = {
async update (request, response) {
const sql = `
UPDATE Users SET
UserName = '${request.body.new_username}',
UserPassword = '${request.body.new_password}',
NameImage = '${request.body.name_image}',
UrlImage = '${request.body.url_image}'
UserName = '${request.body.username}',
UserPassword = '${request.body.password}'
WHERE
UserName='${request.body.username}' AND
UserPassword = '${request.body.password}';
UserPassword = '${request.body.oldPassword}';
`
console.log(sql)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed backend/imgs/sala.png
Binary file not shown.
18 changes: 12 additions & 6 deletions backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ const express = require('express')
const routes = require('./routes')
const http = require('http')
const path = require('path')

const cors = require('cors')
const socket = require('./utils/websocket')
const app = express()
const server = http.Server(app)

app.use(function(req, res, next) {
app.use(cors({}))
app.use(express.json())
app.use(express.urlencoded({extended: true}))
routes.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); // update to match the domain you will make the request from
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
console.log(req.headers)
res.header('Access-Control-Allow-Methods','*')
next();
});
app.use(express.json())
});

app.use(routes)
app.use(express.static(path.join('imgs')))
server.listen(3333)


server.listen(3333)
4 changes: 1 addition & 3 deletions backend/migrate/Schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ async function SchemaUsers () {
CREATE TABLE Users (
UserID INT AUTO_INCREMENT PRIMARY KEY,
UserName VARCHAR(255) NOT NULL,
UserPassword VARCHAR(255) NOT NULL,
NameImage VARCHAR(255) NOT NULL,
UrlImage VARCHAR(255)
UserPassword VARCHAR(255) NOT NULL
);
`
await connection.query(sql,(err, results, fields)=>{
Expand Down
1 change: 1 addition & 0 deletions backend/node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 74 additions & 2 deletions backend/node_modules/.yarn-integrity

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions backend/node_modules/after/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions backend/node_modules/after/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions backend/node_modules/after/LICENCE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 115 additions & 0 deletions backend/node_modules/after/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions backend/node_modules/after/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions backend/node_modules/after/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9192978

Please sign in to comment.