summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSheogorath2020-03-22 00:19:18 +0100
committerGitHub2020-03-22 00:19:18 +0100
commit9425caf6c3da15996faad7dce97e134b5857250d (patch)
treeb78d82aa803fc1e49b72ed99520cbc8d75f12b58 /bin
parentf42304c967a62e5a4c569261846990d1769268e3 (diff)
parente0f729e0148631226c0a9ab26d2bff15c63303cb (diff)
Merge pull request #305 from ErikMichelson/fix/eslint
Fixed eslint errors in cleanup-script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cleanup42
1 files changed, 23 insertions, 19 deletions
diff --git a/bin/cleanup b/bin/cleanup
index b77fdb4e..edf72bf2 100755
--- a/bin/cleanup
+++ b/bin/cleanup
@@ -1,11 +1,11 @@
#!/usr/bin/env node
-const logger = require("../lib/logger");
+const logger = require('../lib/logger')
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({
include: [{
model: models.User,
@@ -13,14 +13,15 @@ async function cleanup() {
attributes: ['id']
}],
attributes: ['id', 'ownerId']
- }).then(async function(notes) {
- for(let i =0, noteCount = notes.length; i< noteCount; i++) {
+ }).then(async function (notes) {
+ for (let i = 0, noteCount = notes.length; i < noteCount; i++) {
const item = notes[i]
- if(item.ownerId != null && !item.owner) {
+ if (item.ownerId != null && !item.owner) {
await models.Note.destroy({
where: {
id: item.id
- }})
+ }
+ })
await models.Revision.destroy({
where: {
noteId: item.id
@@ -42,14 +43,15 @@ async function cleanup() {
attributes: ['id']
}],
attributes: ['id', 'userId']
- }).then(async function(authors) {
- for(let i =0, authorCount = authors.length; i< authorCount; i++) {
+ }).then(async function (authors) {
+ for (let i = 0, authorCount = authors.length; i < authorCount; i++) {
const item = authors[i]
- if(item.userId != null && !item.user) {
+ if (item.userId != null && !item.user) {
await models.Author.destroy({
where: {
id: item.id
- }})
+ }
+ })
logger.info(`Deleted authorship ${item.id} from user ${item.userId}`)
}
}
@@ -62,14 +64,15 @@ async function cleanup() {
attributes: ['id']
}],
attributes: ['id', 'noteId']
- }).then(async function(authors) {
- for(let i =0, authorCount = authors.length; i< authorCount; i++) {
+ }).then(async function (authors) {
+ for (let i = 0, authorCount = authors.length; i < authorCount; i++) {
const item = authors[i]
- if(item.noteId != null && !item.note) {
+ if (item.noteId != null && !item.note) {
await models.Author.destroy({
where: {
id: item.id
- }})
+ }
+ })
logger.info(`Deleted authorship ${item.id} from note ${item.noteId}`)
}
}
@@ -82,14 +85,15 @@ async function cleanup() {
attributes: ['id']
}],
attributes: ['id', 'noteId']
- }).then(async function(revisions) {
- for(let i =0, revisionCount = revisions.length; i< revisionCount; i++) {
+ }).then(async function (revisions) {
+ for (let i = 0, revisionCount = revisions.length; i < revisionCount; i++) {
const item = revisions[i]
- if(item.noteId != null && !item.note) {
+ if (item.noteId != null && !item.note) {
await models.Revision.destroy({
where: {
id: item.id
- }})
+ }
+ })
logger.info(`Deleted revision ${item.id} from note ${item.userId}`)
}
}