mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
addressing #85
This commit is contained in:
parent
fde382f9e8
commit
f9dd4e05f7
1 changed files with 10 additions and 8 deletions
|
@ -35,8 +35,10 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sync db
|
// sync db
|
||||||
const db = require('./api/models')
|
const db = require('./api/models/index')
|
||||||
const users = await db.user.findAll()
|
const User = require('./api/models/user')
|
||||||
|
const Notification = require('./api/models/notification')
|
||||||
|
const users = await User.findAll()
|
||||||
if (users.length) {
|
if (users.length) {
|
||||||
consola.warn(' ⚠ Non empty db! Please move your current db elsewhere than retry.')
|
consola.warn(' ⚠ Non empty db! Please move your current db elsewhere than retry.')
|
||||||
return false
|
return false
|
||||||
|
@ -44,7 +46,7 @@ module.exports = {
|
||||||
|
|
||||||
// create admin user
|
// create admin user
|
||||||
consola.info(`Create admin with email: ${admin.email}`)
|
consola.info(`Create admin with email: ${admin.email}`)
|
||||||
await db.user.create({
|
await User.create({
|
||||||
email: admin.email,
|
email: admin.email,
|
||||||
password: admin.password,
|
password: admin.password,
|
||||||
is_admin: true,
|
is_admin: true,
|
||||||
|
@ -61,18 +63,18 @@ module.exports = {
|
||||||
// })
|
// })
|
||||||
|
|
||||||
// send confirmed events to mastodon
|
// send confirmed events to mastodon
|
||||||
await db.notification.create({ action: 'Create', type: 'ap', filters: { is_visible: true } })
|
await Notification.create({ action: 'Create', type: 'ap', filters: { is_visible: true } })
|
||||||
await db.notification.create({ action: 'Update', type: 'ap', filters: { is_visible: true } })
|
await Notification.create({ action: 'Update', type: 'ap', filters: { is_visible: true } })
|
||||||
await db.notification.create({ action: 'Delete', type: 'ap', filters: { is_visible: true } })
|
await Notification.create({ action: 'Delete', type: 'ap', filters: { is_visible: true } })
|
||||||
|
|
||||||
// send anon events to admin
|
// send anon events to admin
|
||||||
await db.notification.create({ action: 'Create', type: 'admin_email', filters: { is_visible: false } })
|
await Notification.create({ action: 'Create', type: 'admin_email', filters: { is_visible: false } })
|
||||||
|
|
||||||
// TODO email's notifications
|
// TODO email's notifications
|
||||||
// await db.notification.create({ action: 'Create', type: 'email', filters: { is_visible: true } })
|
// await db.notification.create({ action: 'Create', type: 'email', filters: { is_visible: true } })
|
||||||
|
|
||||||
// close db connection
|
// close db connection
|
||||||
await db.sequelize.close()
|
await db.close()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue