mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Fixed eslint errors (whitespaces)
Signed-off-by: Erik Michelson <erik@liltv.de>
This commit is contained in:
parent
f42304c967
commit
e0f729e014
1 changed files with 23 additions and 19 deletions
42
bin/cleanup
42
bin/cleanup
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const logger = require("../lib/logger");
|
const logger = require('../lib/logger')
|
||||||
const models = require('../lib/models')
|
const models = require('../lib/models')
|
||||||
|
|
||||||
logger.info("Cleaning up notes that should already have been removed. Sorry.")
|
logger.info('Cleaning up notes that should already have been removed. Sorry.')
|
||||||
|
|
||||||
async function cleanup() {
|
async function cleanup () {
|
||||||
await models.Note.findAll({
|
await models.Note.findAll({
|
||||||
include: [{
|
include: [{
|
||||||
model: models.User,
|
model: models.User,
|
||||||
|
@ -13,14 +13,15 @@ async function cleanup() {
|
||||||
attributes: ['id']
|
attributes: ['id']
|
||||||
}],
|
}],
|
||||||
attributes: ['id', 'ownerId']
|
attributes: ['id', 'ownerId']
|
||||||
}).then(async function(notes) {
|
}).then(async function (notes) {
|
||||||
for(let i =0, noteCount = notes.length; i< noteCount; i++) {
|
for (let i = 0, noteCount = notes.length; i < noteCount; i++) {
|
||||||
const item = notes[i]
|
const item = notes[i]
|
||||||
if(item.ownerId != null && !item.owner) {
|
if (item.ownerId != null && !item.owner) {
|
||||||
await models.Note.destroy({
|
await models.Note.destroy({
|
||||||
where: {
|
where: {
|
||||||
id: item.id
|
id: item.id
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
await models.Revision.destroy({
|
await models.Revision.destroy({
|
||||||
where: {
|
where: {
|
||||||
noteId: item.id
|
noteId: item.id
|
||||||
|
@ -42,14 +43,15 @@ async function cleanup() {
|
||||||
attributes: ['id']
|
attributes: ['id']
|
||||||
}],
|
}],
|
||||||
attributes: ['id', 'userId']
|
attributes: ['id', 'userId']
|
||||||
}).then(async function(authors) {
|
}).then(async function (authors) {
|
||||||
for(let i =0, authorCount = authors.length; i< authorCount; i++) {
|
for (let i = 0, authorCount = authors.length; i < authorCount; i++) {
|
||||||
const item = authors[i]
|
const item = authors[i]
|
||||||
if(item.userId != null && !item.user) {
|
if (item.userId != null && !item.user) {
|
||||||
await models.Author.destroy({
|
await models.Author.destroy({
|
||||||
where: {
|
where: {
|
||||||
id: item.id
|
id: item.id
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
logger.info(`Deleted authorship ${item.id} from user ${item.userId}`)
|
logger.info(`Deleted authorship ${item.id} from user ${item.userId}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,14 +64,15 @@ async function cleanup() {
|
||||||
attributes: ['id']
|
attributes: ['id']
|
||||||
}],
|
}],
|
||||||
attributes: ['id', 'noteId']
|
attributes: ['id', 'noteId']
|
||||||
}).then(async function(authors) {
|
}).then(async function (authors) {
|
||||||
for(let i =0, authorCount = authors.length; i< authorCount; i++) {
|
for (let i = 0, authorCount = authors.length; i < authorCount; i++) {
|
||||||
const item = authors[i]
|
const item = authors[i]
|
||||||
if(item.noteId != null && !item.note) {
|
if (item.noteId != null && !item.note) {
|
||||||
await models.Author.destroy({
|
await models.Author.destroy({
|
||||||
where: {
|
where: {
|
||||||
id: item.id
|
id: item.id
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
logger.info(`Deleted authorship ${item.id} from note ${item.noteId}`)
|
logger.info(`Deleted authorship ${item.id} from note ${item.noteId}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,14 +85,15 @@ async function cleanup() {
|
||||||
attributes: ['id']
|
attributes: ['id']
|
||||||
}],
|
}],
|
||||||
attributes: ['id', 'noteId']
|
attributes: ['id', 'noteId']
|
||||||
}).then(async function(revisions) {
|
}).then(async function (revisions) {
|
||||||
for(let i =0, revisionCount = revisions.length; i< revisionCount; i++) {
|
for (let i = 0, revisionCount = revisions.length; i < revisionCount; i++) {
|
||||||
const item = revisions[i]
|
const item = revisions[i]
|
||||||
if(item.noteId != null && !item.note) {
|
if (item.noteId != null && !item.note) {
|
||||||
await models.Revision.destroy({
|
await models.Revision.destroy({
|
||||||
where: {
|
where: {
|
||||||
id: item.id
|
id: item.id
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
logger.info(`Deleted revision ${item.id} from note ${item.userId}`)
|
logger.info(`Deleted revision ${item.id} from note ${item.userId}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue