Move user deletion to worker (#15586)
* WIP(delete): remove business logic from controller
* fix(deletion): handle group leave logic on app server still
* fix(lint): unused import
* fix(import): bracket syntax
* fix(test): adapt test for worker flow
* fix(deletion): update delete/feedback form copy
* fix(text): don't break to new paragraph about Gems
* fix(deletion): remove orphaned chat messages
* Revert "fix(deletion): handle group leave logic on app server still"
This reverts commit 9db541f4c3.
* fix(tests): remove tests
These can potentially be tested in the worker's suite? They target functionality that the group leave route handles within the deletion flow
* fix(lint): no-undef
* refactor redis setup into own file and use ioredis
* use bullmq directly to schedule jobs
* add space
* add key prefix
* add semicolon
* fix(jobs): update redis package
---------
Co-authored-by: Phillip Thelen <phillip@habitica.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { sendJob } from '../../libs/worker';
|
||||
import worker from '../../libs/worker';
|
||||
import { authWithHeaders } from '../../middlewares/auth';
|
||||
import { ensurePermission } from '../../middlewares/ensureAccessRight';
|
||||
import { TransactionModel as Transaction } from '../../models/transaction';
|
||||
@@ -48,7 +48,8 @@ api.deleteMember = {
|
||||
req.checkQuery('deleteAmplitude').optional().isIn(['true', 'false']);
|
||||
const validationErrors = req.validationErrors();
|
||||
if (validationErrors) throw validationErrors;
|
||||
sendJob('delete-user', {
|
||||
await worker.sendJob('deleteUser', {
|
||||
identifier: req.params.memberId,
|
||||
data: {
|
||||
userId: req.params.memberId,
|
||||
deleteAccount: req.query.deleteAccount === 'true',
|
||||
|
||||
Reference in New Issue
Block a user