front end, config
This commit is contained in:
@@ -6,28 +6,28 @@ const Event = db.define('event', {
|
||||
title: Sequelize.STRING,
|
||||
description: Sequelize.STRING,
|
||||
multidate: Sequelize.BOOLEAN,
|
||||
start_datetime: { type: Sequelize.DATE, index: true},
|
||||
end_datetime: {type: Sequelize.DATE, index: true},
|
||||
start_datetime: { type: Sequelize.DATE, index: true },
|
||||
end_datetime: { type: Sequelize.DATE, index: true },
|
||||
image_path: Sequelize.STRING,
|
||||
activitypub_id: { type: Sequelize.INTEGER, index: true },
|
||||
activitypub_id: { type: Sequelize.INTEGER, index: true }
|
||||
})
|
||||
|
||||
const Tag = db.define('tag', {
|
||||
tag: { type: Sequelize.STRING, index: true, unique: true, primaryKey: true},
|
||||
tag: { type: Sequelize.STRING, index: true, unique: true, primaryKey: true },
|
||||
color: { type: Sequelize.STRING }
|
||||
})
|
||||
|
||||
const Comment = db.define('comment', {
|
||||
activitypub_id: { type: Sequelize.INTEGER, index: true },
|
||||
author: Sequelize.STRING,
|
||||
text: Sequelize.STRING,
|
||||
text: Sequelize.STRING
|
||||
})
|
||||
|
||||
const MailSubscription = db.define('subscription' , {
|
||||
const MailSubscription = db.define('subscription', {
|
||||
filters: Sequelize.JSON,
|
||||
mail: Sequelize.TEXT,
|
||||
send_on_add: Sequelize.BOOLEAN,
|
||||
send_reminder: Sequelize.INTEGER,
|
||||
send_reminder: Sequelize.INTEGER
|
||||
})
|
||||
|
||||
const Place = db.define('place', {
|
||||
@@ -38,15 +38,13 @@ const Place = db.define('place', {
|
||||
Comment.belongsTo(Event)
|
||||
Event.hasMany(Comment)
|
||||
|
||||
Event.belongsToMany(Tag, {through: 'tagEvent'})
|
||||
Tag.belongsToMany(Event, {through: 'tagEvent'})
|
||||
Event.belongsToMany(Tag, { through: 'tagEvent' })
|
||||
Tag.belongsToMany(Event, { through: 'tagEvent' })
|
||||
|
||||
Event.belongsToMany(User, {through: 'boost'})
|
||||
Event.belongsTo(User)
|
||||
Event.belongsTo(Place)
|
||||
|
||||
User.hasMany(Event)
|
||||
Place.hasMany(Event)
|
||||
User.belongsToMany(User, {through: 'userFollower', as: 'follower'})
|
||||
|
||||
module.exports = { Event, Comment, Tag, Place }
|
||||
module.exports = { Event, Comment, Tag, Place, MailSubscription }
|
||||
|
||||
@@ -3,19 +3,20 @@ const db = require('../db')
|
||||
const Sequelize = require('sequelize')
|
||||
|
||||
const User = db.define('user', {
|
||||
email: {
|
||||
email: {
|
||||
type: Sequelize.STRING,
|
||||
unique: {msg: 'Email already exists'},
|
||||
index: true, allowNull: false },
|
||||
unique: { msg: 'Email already exists' },
|
||||
index: true,
|
||||
allowNull: false
|
||||
},
|
||||
description: Sequelize.TEXT,
|
||||
password: Sequelize.STRING,
|
||||
is_admin: Sequelize.BOOLEAN,
|
||||
is_active: Sequelize.BOOLEAN,
|
||||
instance: Sequelize.STRING,
|
||||
mastodon_instance: Sequelize.STRING,
|
||||
mastodon_auth: Sequelize.JSON
|
||||
})
|
||||
|
||||
|
||||
User.prototype.comparePassword = async function (pwd) {
|
||||
if (!this.password) return false
|
||||
const ret = await bcrypt.compare(pwd, this.password)
|
||||
|
||||
Reference in New Issue
Block a user