refactor
This commit is contained in:
parent
3e139a19ce
commit
64133d7e01
|
@ -46,10 +46,8 @@ export class DeleteAccountService {
|
||||||
const _user = await this.usersRepository.findOneByOrFail({ id: user.id });
|
const _user = await this.usersRepository.findOneByOrFail({ id: user.id });
|
||||||
|
|
||||||
const systemAccounts = await this.systemAccountService.list();
|
const systemAccounts = await this.systemAccountService.list();
|
||||||
for (const systemAccount of systemAccounts) {
|
if (systemAccounts.some(x => x.id === user.id)) {
|
||||||
if (systemAccount.userId === user.id) {
|
throw new Error('cannot delete a system account');
|
||||||
throw new Error('cannot delete a system account');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moderator != null) {
|
if (moderator != null) {
|
||||||
|
|
Loading…
Reference in New Issue