Skip to content

Commit 98a6bf7

Browse files
committed
fix: user hard delete
1 parent 060675e commit 98a6bf7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/controllers/user.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,12 @@ export class MypageController extends Controller {
353353
): Promise<ITsoaSuccessResponse<string>> {
354354
const userId = req.user!.id;
355355
const success = await removeUser(userId);
356+
const sessionID = req.sessionID;
357+
if (sessionID.trim() === '') {
358+
throw new AuthError({reason: 'Session ID가 존재하지 않습니다'});
359+
}
360+
await logoutUserService(sessionID);
361+
req.session.destroy(() => {});
356362

357363
if (!success) {
358364
throw new AuthError({reason: 'user를 찾을 수 없습니다'});

src/repositories/user.repository.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ export const findUserById = async (
1818

1919
export const deleteUser = async (userId: bigint): Promise<boolean> => {
2020
await prisma.user
21-
.update({
21+
.delete({
2222
where: {id: userId},
23-
data: {status: 0},
2423
})
2524
.catch(err => {
2625
throw new DBError({reason: err.message});

0 commit comments

Comments
 (0)