This commit is contained in:
@@ -137,15 +137,19 @@ export class UsersService {
|
||||
async terminateSession(sessionId: string) {
|
||||
const session = await this.authPrisma.refreshToken.findUnique({
|
||||
where: { id: sessionId },
|
||||
select: { id: true },
|
||||
select: { id: true, userId: true },
|
||||
});
|
||||
|
||||
if (!session) {
|
||||
throw new NotFoundException('세션을 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
await this.authPrisma.refreshToken.update({
|
||||
where: { id: sessionId },
|
||||
await this.authPrisma.refreshToken.updateMany({
|
||||
where: {
|
||||
userId: session.userId,
|
||||
revokedAt: null,
|
||||
expiresAt: { gt: new Date() },
|
||||
},
|
||||
data: { revokedAt: new Date() },
|
||||
});
|
||||
|
||||
@@ -171,5 +175,5 @@ function getSessionState(
|
||||
return '만료';
|
||||
}
|
||||
|
||||
return '활성';
|
||||
return '유효토큰';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user