Analytics Update #43

Merged
bones7242 merged 5 commits from analytics into master 2017-06-28 06:40:46 +02:00
3 changed files with 10 additions and 5 deletions
Showing only changes of commit 7e8bb07ca9 - Show all commits

View file

@ -1,11 +1,16 @@
const db = require('../../models');
const logger = require('winston');
function createAnalyticsRecord (action, url, ipAddress, result) {
db.Usage.create({
db.Analytics.create({
action,
url,
ipAddress,
result,
})
.then()
.catch(error => {
logger.error('sequelize error', error);
});
};

View file

@ -1,6 +1,6 @@
module.exports = (sequelize, { STRING }) => {
const Usage = sequelize.define(
'Usage',
const Analytics = sequelize.define(
'Analytics',
{
action: {
type : STRING,
@ -23,5 +23,5 @@ module.exports = (sequelize, { STRING }) => {
freezeTableName: true,
}
);
return Usage;
return Analytics;
};

View file

@ -67,7 +67,7 @@ const http = require('./routes/sockets-routes.js')(app, siofu, hostedContentPath
// sync sequelize
// wrap the server in socket.io to intercept incoming sockets requests
// start server
db.sequelize.sync({}).then(() => {
db.sequelize.sync().then(() => {
http.listen(PORT, () => {
winston.info(`Server is listening on PORT ${PORT}`);
});