This commit is contained in:
lesion
2019-06-07 17:02:33 +02:00
parent 7455553129
commit c408c44676
40 changed files with 270 additions and 279 deletions

View File

@@ -1,11 +1,11 @@
'use strict';
'use strict'
module.exports = (sequelize, DataTypes) => {
const event = sequelize.define('event', {
title: DataTypes.STRING,
slug: DataTypes.STRING,
description: DataTypes.TEXT,
multidate: DataTypes.BOOLEAN,
start_datetime: {
start_datetime: {
type: DataTypes.DATE,
index: true
},
@@ -16,16 +16,16 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.BIGINT,
index: true
}
}, {});
event.associate = function(models) {
}, {})
event.associate = function (models) {
event.belongsTo(models.place)
event.belongsTo(models.user)
event.belongsToMany(models.tag, { through: 'event_tags' })
event.belongsToMany(models.notification, { through: 'event_notification' })
event.hasMany(models.comment)
// Tag.belongsToMany(Event, { through: 'tagEvent' })
// Tag.belongsToMany(Event, { through: 'tagEvent' })
// Event.hasMany(models.Tag)
// associations can be defined here
};
return event;
};
}
return event
};