summaryrefslogtreecommitdiff
path: root/lib/models/author.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/models/author.js74
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
+}