Skip to content
Snippets Groups Projects

조합 이름 변경 에러 수정

Merged Lee WooChang requested to merge fix/update-combination-name into main
4 files
+ 28
4
Compare changes
  • Side-by-side
  • Inline

Files

+ 25
1
import pool from '../db.js';
const myRepository = {
async checkUserExists(userId) {
const query = `
SELECT 1
FROM users
WHERE id = $1
`;
const values = [userId];
const { rows } = await pool.query(query, values);
return rows.length > 0;
},
async getCombinationById(combinationId) {
const query = `
SELECT id, name, owner_id AS "userId"
FROM combinations
WHERE id = $1
`;
const values = [combinationId];
const { rows } = await pool.query(query, values);
return rows.length > 0 ? rows[0] : null;
},
async getCombinationsByUserId(userId) {
const query = `
SELECT id, name
@@ -49,7 +73,7 @@ const myRepository = {
async updateCombinationName(combinationId, newName) {
const query = `
UPDATE combinations
SET name = $1, updated_at = NOW()
SET name = $1
WHERE id = $2
`;
const values = [newName, combinationId];
Loading