Skip to content

Commit 4fd26ac

Browse files
committed
hotfix: 쿼리 작성 시 qr_login_tokens가 아닌 users_qrlogintoken으로 수정
1 parent 245a721 commit 4fd26ac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/repositories/__test__/qr.repo.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('QRLoginTokenRepository', () => {
6666

6767
await expect(repo.markTokenUsed('token')).resolves.not.toThrow();
6868
expect(mockPool.query).toHaveBeenCalledWith(
69-
expect.stringContaining('UPDATE qr_login_tokens SET is_used = true'),
69+
expect.stringContaining('UPDATE users_qrlogintoken SET is_used = true'),
7070
['token']
7171
);
7272
});

src/repositories/qr.repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class QRLoginTokenRepository {
99
async createQRLoginToken(token: string, userId: number, ip: string, userAgent: string): Promise<void> {
1010
try {
1111
const query = `
12-
INSERT INTO qr_login_tokens (token, user_id, created_at, expires_at, is_used, ip_address, user_agent)
12+
INSERT INTO users_qrlogintoken (token, user_id, created_at, expires_at, is_used, ip_address, user_agent)
1313
VALUES ($1, $2, NOW(), NOW() + INTERVAL '5 minutes', false, $3, $4);
1414
`;
1515
await this.pool.query(query, [token, userId, ip, userAgent]);
@@ -23,7 +23,7 @@ export class QRLoginTokenRepository {
2323
try {
2424
const query = `
2525
SELECT *
26-
FROM qr_login_tokens
26+
FROM users_qrlogintoken
2727
WHERE token = $1 AND is_used = false AND expires_at > NOW();
2828
`;
2929
const result = await this.pool.query(query, [token]);
@@ -37,7 +37,7 @@ export class QRLoginTokenRepository {
3737
async markTokenUsed(token: string): Promise<void> {
3838
try {
3939
const query = `
40-
UPDATE qr_login_tokens SET is_used = true WHERE token = $1;
40+
UPDATE users_qrlogintoken SET is_used = true WHERE token = $1;
4141
`;
4242
await this.pool.query(query, [token]);
4343
} catch (error) {

0 commit comments

Comments
 (0)