Added users to games in sample data

main
Umbra Sheep 7 years ago
parent 294b3ff7d3
commit e0377fc548

@ -9,7 +9,7 @@ exports.connect = function(done){
state.pool = mysql.createPool({
host: 'localhost',
user: 'root',
password: '',
password: 'root',
port: 3306,
database: "territory-walker",
//multipleStatements: true

@ -63,13 +63,17 @@ BEGIN
DECLARE lastid VARCHAR(36) DEFAULT UUID();
INSERT INTO `polygonArea` (gameID, polygonID, userID, area) VALUES
(gID, lastid, usID, a);
SELECT * FROM `polygonArea` WHERE polygonID = lastid;
SELECT * FROM `polygonArea`
JOIN userJoinedGames ON
userJoinedGames.userID = polygonArea.userID AND userJoinedGames.gameID = polygonArea.gameID
WHERE polygonID = lastid;
END //
DELIMITER ;
INSERT INTO `gameInstances` (gameID) VALUES ("samdum");
INSERT INTO `users` (userID, nickname) VALUES ("samded", "Lesmaux");
INSERT INTO `users` (userID, nickname) VALUES ("fanded", "Umbra Sheep");
INSERT INTO `userJoinedGames` (userID, gameID, colour) VALUES ("samded", "samdum", "0000FF");
INSERT INTO `polygonArea` (gameID, polygonID, userID, area) VALUES
("samdum", "someuniqueid", "samded", 100000.1);
INSERT INTO `polygonPoints` (polygonID, lat, lng) VALUES

@ -7,7 +7,11 @@ module.exports = {
if (req.query.gameID != null) {
let query = "CALL getPolygonPoints(\"" + req.query.gameID + "\");";
db.get().query(query, function(err, rows){
if (err) return res.send(400);
if (err) {
console.log(err);
return res.send(400);
}
// console.log(rows);
res.send(rows[0]);
return;
});
@ -20,7 +24,6 @@ module.exports = {
let gameID = req.body.gameID;
let userID = req.body.userID;
let points = JSON.parse(req.body.points);
console.log(points);
if (points.length < 2) {
res.send([]);
} else {

Loading…
Cancel
Save