-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from kengz/convo-engine-and-style-fixes
ESLint style fixes; convo engine
- Loading branch information
Showing
41 changed files
with
795 additions
and
710 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": "airbnb", | ||
"plugins": [ | ||
"react", | ||
"jsx-a11y", | ||
"import" | ||
], | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"mocha": true | ||
}, | ||
"rules": { | ||
"semi": ["error", "never"], | ||
"import/no-unresolved": 0, | ||
"import/no-extraneous-dependencies": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
'use strict'; | ||
// to create: sequelize migration:create --name create-chatlog | ||
// to run: sequelize db:migrate | ||
// to revert: sequelize db:migrate:undo:all | ||
|
||
module.exports = { | ||
up: function(queryInterface, Sequelize) { | ||
up(queryInterface, Sequelize) { | ||
return queryInterface.createTable('Chatlogs', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
type: Sequelize.INTEGER, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
type: Sequelize.DATE, | ||
}, | ||
adapter: Sequelize.STRING, | ||
userid: Sequelize.STRING, | ||
username: Sequelize.STRING, | ||
room: Sequelize.STRING, | ||
incoming: Sequelize.BOOLEAN, | ||
method: Sequelize.STRING, | ||
message: Sequelize.STRING | ||
}); | ||
message: Sequelize.STRING, | ||
}) | ||
}, | ||
down: function(queryInterface, Sequelize) { | ||
return queryInterface.dropTable('Chatlogs'); | ||
} | ||
}; | ||
down(queryInterface) { | ||
return queryInterface.dropTable('Chatlogs') | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: function(queryInterface, Sequelize) { | ||
up(queryInterface, Sequelize) { | ||
return queryInterface.createTable('Users', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
type: Sequelize.INTEGER, | ||
}, | ||
adapter: { | ||
allowNull: false, | ||
type: Sequelize.STRING | ||
type: Sequelize.STRING, | ||
}, | ||
userid: { | ||
allowNull: false, | ||
type: Sequelize.STRING | ||
type: Sequelize.STRING, | ||
}, | ||
username: { | ||
type: Sequelize.STRING | ||
type: Sequelize.STRING, | ||
}, | ||
profile: { | ||
type: Sequelize.TEXT | ||
envelope: { | ||
type: Sequelize.TEXT, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
type: Sequelize.DATE, | ||
}, | ||
}) | ||
}, | ||
down(queryInterface) { | ||
return queryInterface.dropTable('Users') | ||
}, | ||
down: function(queryInterface, Sequelize) { | ||
return queryInterface.dropTable('Users'); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = { | ||
up(queryInterface, Sequelize) { | ||
return queryInterface.createTable('Cronjobs', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER, | ||
}, | ||
adapter: { | ||
type: Sequelize.STRING, | ||
}, | ||
userid: { | ||
type: Sequelize.STRING, | ||
}, | ||
pattern: { | ||
type: Sequelize.STRING, | ||
}, | ||
command: { | ||
type: Sequelize.TEXT, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
}) | ||
}, | ||
down(queryInterface) { | ||
return queryInterface.dropTable('Cronjobs') | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
'use strict'; | ||
// create with: | ||
// sequelize model:create --name Chatlog --attributes "adapter:string" | ||
|
||
module.exports = function(sequelize, DataTypes) { | ||
var Chatlog = sequelize.define('Chatlog', { | ||
module.exports = function fn(sequelize, DataTypes) { | ||
const Chatlog = sequelize.define('Chatlog', { | ||
adapter: DataTypes.STRING, | ||
userid: DataTypes.STRING, | ||
username: DataTypes.STRING, | ||
room: DataTypes.STRING, | ||
incoming: DataTypes.BOOLEAN, | ||
method: DataTypes.STRING, | ||
message: DataTypes.TEXT | ||
message: DataTypes.TEXT, | ||
}, { | ||
classMethods: { | ||
associate: function(models) { | ||
// associations can be defined here | ||
// Chatlog.belongsTo(models.User) | ||
} | ||
} | ||
}); | ||
return Chatlog; | ||
}; | ||
// associate(models) { | ||
// associations can be defined here | ||
// Chatlog.belongsTo(models.User) | ||
// }, | ||
}, | ||
}) | ||
return Chatlog | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = function fn(sequelize, DataTypes) { | ||
const Cronjob = sequelize.define('Cronjob', { | ||
adapter: DataTypes.STRING, | ||
userid: DataTypes.STRING, | ||
pattern: DataTypes.STRING, | ||
command: DataTypes.TEXT, | ||
}, { | ||
classMethods: { | ||
// associate(models) { | ||
// associations can be defined here | ||
// }, | ||
}, | ||
}) | ||
return Cronjob | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
'use strict'; | ||
const fs = require('fs') | ||
const path = require('path') | ||
const Sequelize = require('sequelize') | ||
const fullConfig = require('../../config/db.json') | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const Sequelize = require('sequelize'); | ||
const basename = path.basename(module.filename); | ||
const env = process.env.NODE_ENV || 'development'; | ||
const config = require(path.join(__dirname, '..', '..', 'config', 'db.json'))[env]; | ||
var db = {}; | ||
var sequelize | ||
const basename = path.basename(module.filename) | ||
const env = process.env.NODE_ENV || 'development' | ||
const config = fullConfig[env] | ||
const db = {} | ||
let sequelize | ||
|
||
if (config.use_env_variable) { | ||
sequelize = new Sequelize(process.env[config.use_env_variable]); | ||
sequelize = new Sequelize(process.env[config.use_env_variable]) | ||
} else { | ||
sequelize = new Sequelize(config.database, config.username, config.password, config); | ||
sequelize = new Sequelize(config.database, config.username, config.password, config) | ||
} | ||
|
||
fs | ||
.readdirSync(__dirname) | ||
.filter((file) => { | ||
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js'); | ||
}) | ||
.filter(file => (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js')) | ||
.forEach((file) => { | ||
var model = sequelize['import'](path.join(__dirname, file)); | ||
db[model.name] = model; | ||
}); | ||
const model = sequelize.import(path.join(__dirname, file)) | ||
db[model.name] = model | ||
}) | ||
|
||
Object.keys(db).forEach((modelName) => { | ||
if (db[modelName].associate) { | ||
db[modelName].associate(db); | ||
db[modelName].associate(db) | ||
} | ||
}); | ||
}) | ||
|
||
db.sequelize = sequelize; | ||
db.Sequelize = Sequelize; | ||
db.sequelize = sequelize | ||
db.Sequelize = Sequelize | ||
|
||
module.exports = db; | ||
module.exports = db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
'use strict'; | ||
module.exports = function(sequelize, DataTypes) { | ||
var User = sequelize.define('User', { | ||
module.exports = function fn(sequelize, DataTypes) { | ||
const User = sequelize.define('User', { | ||
adapter: DataTypes.STRING, | ||
userid: DataTypes.STRING, | ||
username: DataTypes.STRING, | ||
profile: DataTypes.TEXT | ||
envelope: DataTypes.TEXT, | ||
}, { | ||
classMethods: { | ||
associate: function(models) { | ||
// associations can be defined here | ||
} | ||
} | ||
}); | ||
return User; | ||
}; | ||
// associate(models) { | ||
// associations can be defined here | ||
// }, | ||
}, | ||
}) | ||
return User | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.