-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from catholichak2024/feat/#84_search-subject-id
[FEAT] μμ κ²μ id λ°ν
- Loading branch information
Showing
4 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { searchDTO } from "./search.dto.js"; | ||
import { searchRepo } from "./search.repository.js"; | ||
|
||
export const searchService = async (query) => { | ||
export const searchService = async (userId, query) => { | ||
const { type, name } = query; | ||
const major = await searchRepo(type, name); | ||
const major = await searchRepo(userId, type, name); | ||
return searchDTO(major); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
export const searchSql = | ||
"SELECT credit, name, CASE WHEN us.user_id IS NOT NULL THEN 1 ELSE 0 END AS bookmark FROM subject s " | ||
+ "JOIN user_subject us ON s.name = us.subject_name " | ||
"SELECT s.id, credit, name, CASE WHEN us.user_id IS NOT NULL THEN 1 ELSE 0 END AS bookmark FROM subject s " | ||
+ "JOIN user_subject us ON s.name = us.subject_name AND user_id = ? " | ||
+ "WHERE type = ? ORDER BY s.id;" | ||
|
||
export const searchNameSql = | ||
"SELECT credit, name, CASE WHEN us.user_id IS NOT NULL THEN 1 ELSE 0 END AS bookmark FROM subject s " | ||
+ "JOIN user_subject us ON s.name = us.subject_name " | ||
"SELECT s.id, credit, name, CASE WHEN us.user_id IS NOT NULL THEN 1 ELSE 0 END AS bookmark FROM subject s " | ||
+ "JOIN user_subject us ON s.name = us.subject_name AND user_id = ? " | ||
+ "WHERE type = ? AND name REGEXP ? ORDER BY s.id;" |