Skip to content

Commit e273b43

Browse files
authored
fix: rm bulk delete (#601)
1 parent 8ed2260 commit e273b43

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

src/user/user.controller.ts

-7
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ export class UserController {
5858
return await this.userService.deleteUser(req['user'].user as UserEntity);
5959
}
6060

61-
@ApiBearerAuth('access-token')
62-
@Delete('/bulk-delete')
63-
@UseGuards(SuperAdminAuthGuard)
64-
async bulkDeleteUsers(): Promise<UserEntity[]> {
65-
return await this.userService.bulkDeleteUsers();
66-
}
67-
6861
// This route must go before the Delete user route below as we want nestjs to check against this one first
6962
@ApiBearerAuth('access-token')
7063
@Delete('/cypress')

src/user/user.service.ts

+1-18
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Logger } from 'src/logger/logger';
99
import { ServiceUserProfilesService } from 'src/service-user-profiles/service-user-profiles.service';
1010
import { SubscriptionUserService } from 'src/subscription-user/subscription-user.service';
1111
import { TherapySessionService } from 'src/therapy-session/therapy-session.service';
12-
import { isProduction, SIGNUP_TYPE } from 'src/utils/constants';
12+
import { SIGNUP_TYPE } from 'src/utils/constants';
1313
import { FIREBASE_ERRORS } from 'src/utils/errors';
1414
import { FIREBASE_EVENTS, USER_SERVICE_EVENTS } from 'src/utils/logs';
1515
import { ILike, IsNull, Not, Repository } from 'typeorm';
@@ -327,23 +327,6 @@ export class UserService {
327327
return deletedUsers;
328328
}
329329

330-
public async bulkDeleteUsers(): Promise<UserEntity[]> {
331-
if (isProduction) {
332-
throw new Error('Bulk delete cannot be performed on production database');
333-
}
334-
335-
let deletedUsers: UserEntity[];
336-
337-
try {
338-
const users = await this.userRepository.find();
339-
340-
deletedUsers = await this.batchDeleteUsers(users);
341-
} catch (error) {
342-
this.logger.error(`deleteFilteredUsers - Unable to delete all users`, error);
343-
}
344-
return deletedUsers;
345-
}
346-
347330
public async deleteCypressTestUsers(clean = false): Promise<UserEntity[]> {
348331
let deletedUsers: UserEntity[];
349332
try {

0 commit comments

Comments
 (0)