color, weigth, locale, config
This commit is contained in:
@@ -20,15 +20,14 @@ module.exports = (sequelize, DataTypes) => {
|
||||
index: true
|
||||
},
|
||||
}, {})
|
||||
|
||||
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' })
|
||||
// Event.hasMany(models.Tag)
|
||||
// associations can be defined here
|
||||
}
|
||||
|
||||
return event
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
}, {})
|
||||
notification.associate = function (models) {
|
||||
notification.belongsToMany(models.event, { through: 'event_notification' })
|
||||
notification.belongsToMany(models.event, { through: models.event_notification })
|
||||
// associations can be defined here
|
||||
}
|
||||
return notification
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
'use strict'
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const place = sequelize.define('place', {
|
||||
name: DataTypes.STRING,
|
||||
address: DataTypes.STRING,
|
||||
weigth: DataTypes.INTEGER
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
unique: true, index: true,
|
||||
allowNull: false
|
||||
},
|
||||
address: DataTypes.STRING
|
||||
}, {})
|
||||
|
||||
place.associate = function (models) {
|
||||
// associations can be defined here
|
||||
place.hasMany(models.event)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ module.exports = (sequelize, DataTypes) => {
|
||||
const tag = sequelize.define('tag', {
|
||||
tag: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
index: true,
|
||||
primaryKey: true
|
||||
},
|
||||
weigth: DataTypes.INTEGER,
|
||||
weigth: { type: DataTypes.INTEGER, defaultValue: 0, allowNull: false },
|
||||
color: DataTypes.STRING
|
||||
}, {})
|
||||
|
||||
tag.associate = function (models) {
|
||||
tag.belongsToMany(models.event, { through: 'event_tags' })
|
||||
// associations can be defined here
|
||||
}
|
||||
|
||||
return tag
|
||||
|
||||
Reference in New Issue
Block a user