mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
minor with new models
This commit is contained in:
parent
cd5c4fae29
commit
c3741238fc
8 changed files with 14 additions and 23 deletions
|
@ -33,7 +33,7 @@ async function modify (args) {
|
|||
|
||||
async function create (args) {
|
||||
await _initializeDB()
|
||||
const User = require('../api/models/user')
|
||||
const { User } = require('../api/models/models')
|
||||
const user = await User.create({
|
||||
email: args.email,
|
||||
is_active: true,
|
||||
|
@ -46,7 +46,7 @@ async function create (args) {
|
|||
|
||||
async function remove (args) {
|
||||
await _initializeDB()
|
||||
const User = require('../api/models/user')
|
||||
const { User } = require('../api/models/models')
|
||||
const user = await User.findOne({
|
||||
where: { email: args.email }
|
||||
})
|
||||
|
@ -58,7 +58,7 @@ async function remove (args) {
|
|||
|
||||
async function list () {
|
||||
await _initializeDB()
|
||||
const User = require('../api/models/user')
|
||||
const { User } = require('../api/models/models')
|
||||
const users = await User.findAll()
|
||||
console.log()
|
||||
users.forEach(u => console.log(`${u.id}\tadmin: ${u.is_admin}\tenabled: ${u.is_active}\temail: ${u.email}`))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Event = require('../api/models/event')
|
||||
const { Event } = require('../api/models/models')
|
||||
const config = require('../config')
|
||||
const log = require('../log')
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@ const express = require('express')
|
|||
const router = express.Router()
|
||||
const cors = require('cors')
|
||||
const Users = require('./users')
|
||||
const Event = require('../api/models/event')
|
||||
const User = require('../api/models/user')
|
||||
const Tag = require('../api/models/tag')
|
||||
const Place = require('../api/models/place')
|
||||
const { Event, User, Tag, Place } = require('../api/models/models')
|
||||
|
||||
const settingsController = require('../api/controller/settings')
|
||||
|
||||
const Helpers = require('./helpers')
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const Event = require('../api/models/event')
|
||||
const Resource = require('../api/models/resource')
|
||||
const APUser = require('../api/models/ap_user')
|
||||
const { Event, Resource, APUser } = require('../api/models/models')
|
||||
|
||||
const log = require('../log')
|
||||
const helpers = require('../helpers')
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
const Event = require('../api/models/event')
|
||||
const Place = require('../api/models/place')
|
||||
const APUser = require('../api/models/ap_user')
|
||||
const Tag = require('../api/models/tag')
|
||||
const { Event, Place, APUser, Tag } = require('../api/models/models')
|
||||
|
||||
const escape = require('lodash/escape')
|
||||
const config = require('../config')
|
||||
const log = require('../log')
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
const express = require('express')
|
||||
const router = express.Router()
|
||||
const Event = require('../api/models/event')
|
||||
const Resource = require('../api/models/resource')
|
||||
const User = require('../api/models/user')
|
||||
const { Event, Resource, User } = require('../api/models/models')
|
||||
|
||||
const cors = require('cors')
|
||||
const settingsController = require('../api/controller/settings')
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const Place = require('../api/models/place')
|
||||
const Event = require('../api/models/event')
|
||||
const { Event, Place } = require('../api/models/models')
|
||||
const Sequelize = require('sequelize')
|
||||
const log = require('../log')
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Tag = require('../api/models/tag')
|
||||
const Event = require('../api/models/event')
|
||||
const { Event, Tag } = require('../api/models/models')
|
||||
|
||||
const Sequelize = require('sequelize')
|
||||
const log = require('../log')
|
||||
|
||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
})
|
||||
|
||||
if (!tags.length) { return }
|
||||
log.info(`Remove ${tags.length} unrelated tags`)
|
||||
log.info(`Remove ${tags.length} orphan tags (${tags.join(', ')})`)
|
||||
|
||||
await Tag.destroy({
|
||||
where: { tag: { [Sequelize.Op.in]: tags.map(p => p.tag) } }
|
||||
|
|
Loading…
Reference in a new issue