diff options
author | BoHong Li | 2017-03-13 02:09:52 +0800 |
---|---|---|
committer | BoHong Li | 2017-03-13 02:09:52 +0800 |
commit | befa89be8b69ed1b951099828c5dbc7e550d4c68 (patch) | |
tree | 835b840c390029c596756a59abc919bf17d14b54 /lib/models/author.js | |
parent | 747da6772d339329ed130f5a0dbc896be5391ef8 (diff) | |
parent | 5bc642d02e8955b200bb21cf30e863fdf0c53765 (diff) |
Merge branch 'use_javascript_standard_style'
Introduce JavaScript Standard Style
Signed-off-by: BoHong Li <a60814billy@gmail.com>
Diffstat (limited to 'lib/models/author.js')
-rw-r--r-- | lib/models/author.js | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/lib/models/author.js b/lib/models/author.js index 0b0f149d..5e39c347 100644 --- a/lib/models/author.js +++ b/lib/models/author.js @@ -1,43 +1,37 @@ -"use strict"; - // external modules -var Sequelize = require("sequelize"); - -// core -var logger = require("../logger.js"); +var Sequelize = require('sequelize') module.exports = function (sequelize, DataTypes) { - var Author = sequelize.define("Author", { - id: { - type: Sequelize.INTEGER, - primaryKey: true, - autoIncrement: true - }, - color: { - type: DataTypes.STRING - } - }, { - indexes: [ - { - unique: true, - fields: ['noteId', 'userId'] - } - ], - classMethods: { - associate: function (models) { - Author.belongsTo(models.Note, { - foreignKey: "noteId", - as: "note", - constraints: false - }); - Author.belongsTo(models.User, { - foreignKey: "userId", - as: "user", - constraints: false - }); - } - } - }); - - return Author; -};
\ No newline at end of file + var Author = sequelize.define('Author', { + id: { + type: Sequelize.INTEGER, + primaryKey: true, + autoIncrement: true + }, + color: { + type: DataTypes.STRING + } + }, { + indexes: [ + { + unique: true, + fields: ['noteId', 'userId'] + } + ], + classMethods: { + associate: function (models) { + Author.belongsTo(models.Note, { + foreignKey: 'noteId', + as: 'note', + constraints: false + }) + Author.belongsTo(models.User, { + foreignKey: 'userId', + as: 'user', + constraints: false + }) + } + } + }) + return Author +} |