实现登出接口

This commit is contained in:
2025-05-07 14:44:07 +08:00
parent 1246613fb1
commit 6a44e902fd
2 changed files with 27 additions and 1 deletions

View File

@@ -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);
}
}
}