From adbea487af1943d2b807e9e22d295d2cef3ce40c Mon Sep 17 00:00:00 2001 From: Umbra Sheep Date: Sun, 30 Sep 2018 20:07:51 +1300 Subject: [PATCH] Changed polygon output to be more friendly --- api/v1/api.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/v1/api.js b/api/v1/api.js index 9d5a2ee..8b5951b 100644 --- a/api/v1/api.js +++ b/api/v1/api.js @@ -12,7 +12,16 @@ module.exports = { return res.send(400); } // console.log(rows); - res.send(rows[0]); + let polygon = {} + polygon.coords = []; + rows[0].map((point) => { + polygon.polygonID = point.polygonID; + polygon.coords.push({lat: point.lat, lng: point.lng}); + polygon.gameID = point.gameID; + polygon.userID = point.userID; + polygon.colour = point.colour; + }); + res.send(polygon); return; }); } else {