updated table name
This commit is contained in:
parent
84c0c37de3
commit
7e8bb07ca9
3 changed files with 10 additions and 5 deletions
|
@ -1,11 +1,16 @@
|
||||||
const db = require('../../models');
|
const db = require('../../models');
|
||||||
|
const logger = require('winston');
|
||||||
|
|
||||||
function createAnalyticsRecord (action, url, ipAddress, result) {
|
function createAnalyticsRecord (action, url, ipAddress, result) {
|
||||||
db.Usage.create({
|
db.Analytics.create({
|
||||||
action,
|
action,
|
||||||
url,
|
url,
|
||||||
ipAddress,
|
ipAddress,
|
||||||
result,
|
result,
|
||||||
|
})
|
||||||
|
.then()
|
||||||
|
.catch(error => {
|
||||||
|
logger.error('sequelize error', error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = (sequelize, { STRING }) => {
|
module.exports = (sequelize, { STRING }) => {
|
||||||
const Usage = sequelize.define(
|
const Analytics = sequelize.define(
|
||||||
'Usage',
|
'Analytics',
|
||||||
{
|
{
|
||||||
action: {
|
action: {
|
||||||
type : STRING,
|
type : STRING,
|
||||||
|
@ -23,5 +23,5 @@ module.exports = (sequelize, { STRING }) => {
|
||||||
freezeTableName: true,
|
freezeTableName: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return Usage;
|
return Analytics;
|
||||||
};
|
};
|
|
@ -67,7 +67,7 @@ const http = require('./routes/sockets-routes.js')(app, siofu, hostedContentPath
|
||||||
// sync sequelize
|
// sync sequelize
|
||||||
// wrap the server in socket.io to intercept incoming sockets requests
|
// wrap the server in socket.io to intercept incoming sockets requests
|
||||||
// start server
|
// start server
|
||||||
db.sequelize.sync({}).then(() => {
|
db.sequelize.sync().then(() => {
|
||||||
http.listen(PORT, () => {
|
http.listen(PORT, () => {
|
||||||
winston.info(`Server is listening on PORT ${PORT}`);
|
winston.info(`Server is listening on PORT ${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue