upd: add additional check from delete endpoint

This commit is contained in:
Marie 2024-10-17 20:15:20 +02:00
parent 360a127ad7
commit 42530b5a39
No known key found for this signature in database
GPG Key ID: 7ADF6C9CD9A28555

View File

@ -41,8 +41,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
const user = await this.usersRepository.findOneBy({ id: ps.userId });
if (user == null) {
throw new Error('user not found');
if (user == null || user.isDeleted) {
throw new Error('user not found or already deleted');
}
const profile = await this.userProfilesRepository.findOneBy({ userId: ps.userId });