mizzkey/packages/backend/src/queue/processors/db/index.ts

38 lines
1.2 KiB
TypeScript
Raw Normal View History

import Bull from 'bull';
import { DbJobData } from '@/queue/types.js';
import { deleteDriveFiles } from './delete-drive-files.js';
import { exportCustomEmojis } from './export-custom-emojis.js';
import { exportNotes } from './export-notes.js';
import { exportFollowing } from './export-following.js';
import { exportMute } from './export-mute.js';
import { exportBlocking } from './export-blocking.js';
import { exportUserLists } from './export-user-lists.js';
import { importFollowing } from './import-following.js';
import { importUserLists } from './import-user-lists.js';
import { deleteAccount } from './delete-account.js';
import { importMuting } from './import-muting.js';
import { importBlocking } from './import-blocking.js';
import { importCustomEmojis } from './import-custom-emojis.js';
2018-03-31 12:55:00 +02:00
2019-03-07 15:07:21 +01:00
const jobs = {
2019-02-20 17:30:21 +01:00
deleteDriveFiles,
exportCustomEmojis,
exportNotes,
2019-02-06 12:56:48 +01:00
exportFollowing,
exportMute,
exportBlocking,
2019-03-11 11:43:58 +01:00
exportUserLists,
2019-03-11 16:34:19 +01:00
importFollowing,
importMuting,
importBlocking,
importUserLists,
2022-01-12 16:47:40 +01:00
importCustomEmojis,
deleteAccount,
2021-05-08 11:56:21 +02:00
} as Record<string, Bull.ProcessCallbackFunction<DbJobData> | Bull.ProcessPromiseFunction<DbJobData>>;
2018-03-31 12:55:00 +02:00
2021-05-08 11:56:21 +02:00
export default function(dbQueue: Bull.Queue<DbJobData>) {
2019-03-07 15:27:38 +01:00
for (const [k, v] of Object.entries(jobs)) {
2021-05-08 11:56:21 +02:00
dbQueue.process(k, v);
2019-03-07 15:27:38 +01:00
}
2019-03-07 15:07:21 +01:00
}