2015-05-19 14:25:35 +02:00
|
|
|
var pg = require('pg');
|
|
|
|
var secret = require('../../private');
|
|
|
|
|
|
|
|
module.exports.index = function(req, res) {
|
|
|
|
|
|
|
|
var user_id = req.session.user_id;
|
|
|
|
var camera = req.body.camera;
|
|
|
|
|
|
|
|
pg.connect(secret.url, function(err, client, release) {
|
|
|
|
client.query(
|
2015-05-20 15:20:59 +02:00
|
|
|
"INSERT INTO keyboardevent(user_id, camera, time)" +
|
|
|
|
"VALUES($1, ROW(ROW($2,$3,$4),ROW($5,$6,$7)), to_timestamp($8));" ,
|
2015-05-19 14:25:35 +02:00
|
|
|
[
|
|
|
|
user_id,
|
|
|
|
camera.position.x,
|
|
|
|
camera.position.y,
|
|
|
|
camera.position.z,
|
|
|
|
|
|
|
|
camera.target.x,
|
|
|
|
camera.target.y,
|
2015-05-20 10:23:19 +02:00
|
|
|
camera.target.z,
|
|
|
|
|
|
|
|
req.body.time
|
2015-05-19 14:25:35 +02:00
|
|
|
],
|
|
|
|
function(err, result) {
|
|
|
|
release();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
|
|
|
res.send("user_id = " + user_id);
|
|
|
|
|
|
|
|
}
|