refactor: Remove user associations before removing user
This commit is contained in:
@@ -250,6 +250,7 @@ class User extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async softRemove() {
|
async softRemove() {
|
||||||
|
await this.softRemoveAssociations();
|
||||||
await this.$query().delete();
|
await this.$query().delete();
|
||||||
|
|
||||||
const jobName = `Delete user - ${this.id}`;
|
const jobName = `Delete user - ${this.id}`;
|
||||||
@@ -260,7 +261,6 @@ class User extends Base {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await deleteUserQueue.add(jobName, jobPayload, jobOptions);
|
await deleteUserQueue.add(jobName, jobPayload, jobOptions);
|
||||||
await this.softRemoveAssociations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async softRemoveAssociations() {
|
async softRemoveAssociations() {
|
||||||
|
Reference in New Issue
Block a user