mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Use JavaScript Standard Style
Introduce JavaScript Standard Style as project style rule, and fixed all fail on backend code.
This commit is contained in:
parent
8f1c97f4a4
commit
4889e9732d
21 changed files with 3723 additions and 3784 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue