实现登出接口
This commit is contained in:
@@ -30,4 +30,18 @@ export class UserSessionService {
|
||||
|
||||
return !!session;
|
||||
}
|
||||
|
||||
async invalidateSession(userId: string, sessionId: string): Promise<void> {
|
||||
const session = await this.userSessionRepository.findOne({
|
||||
where: {
|
||||
userId,
|
||||
sessionId,
|
||||
deletedAt: null,
|
||||
}
|
||||
});
|
||||
|
||||
if (session) {
|
||||
await this.userSessionRepository.softDelete(session.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user