Skip to content

Commit

Permalink
fix(majorUtils getDepartmentIdByMajor): 더 유연하게 학과 ID 값을 구할 수 있도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
pp449 committed Feb 4, 2024
1 parent 264039f commit 6aa4b4f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/utils/majorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { selectQuery } from '@db/query/dbQueryHandler';
import notificationToSlack from 'src/hooks/notificateToSlack';

export const getDepartmentIdByMajor = async (major: string) => {
const [departmentName, departmentSubName] = major.split(' ');
const getDepartmentQuery = `SELECT id FROM departments WHERE department_name = '${departmentName}' ${
departmentSubName ? `AND department_subname = '${departmentSubName}'` : ''
};`;
const getDepartmentQuery = `SELECT id FROM departments WHERE department_name = '${major}' OR department_subname = '${major}'`;

try {
const departmentId = await selectQuery<{ id: number }[]>(
Expand Down

0 comments on commit 6aa4b4f

Please sign in to comment.