完成jwt鉴权

This commit is contained in:
2025-05-07 14:34:49 +08:00
parent d2744689b2
commit 1246613fb1
9 changed files with 139 additions and 17 deletions

View File

@@ -18,4 +18,16 @@ export class UserSessionService {
});
return await this.userSessionRepository.save(session);
}
async isSessionValid(userId: string, sessionId: string): Promise<boolean> {
const session = await this.userSessionRepository.findOne({
where: {
userId,
sessionId,
deletedAt: null,
}
});
return !!session;
}
}