Use JavaScript Standard Style
Introduce JavaScript Standard Style as project style rule, and fixed all fail on backend code.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user