Skip to content

Commit

Permalink
Merge pull request #238 from UMC-README/dev
Browse files Browse the repository at this point in the history
dev -> main 최신화
  • Loading branch information
minhyeokDev authored Aug 20, 2024
2 parents 5e25a41 + 8174981 commit 2a2e88c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions domains/admin/admin.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ export const getPostListService = async (roomId) => {
export const getSubmitListService = async (roomId, postId, state) => {
try {
if (!roomId || !postId) throw new Error("요청 내역 조회를 위한 roomId와 postId가 필요합니다.");
if (state !== "pending" && state !== "complete") {

const normalizedState = state.toLowerCase();
if (normalizedState !== "pending" && normalizedState !== "complete") {
throw new Error("pending 혹은 complete 중 하나의 값으로 요청해야합니다.");
}

const submitList = await getSubmitListDao(roomId, postId, state.toUpperCase());
const submitList = await getSubmitListDao(roomId, postId, normalizedState.toUpperCase());

return submitList;
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion domains/admin/admin.sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const getSubmitStateSQL = `
JOIN submit s ON p.id = s.post_id
JOIN user u ON s.user_id = u.id
LEFT JOIN \`submit-image\` si ON s.id = si.submit_id
WHERE p.room_id = ? AND p.id = ? AND s.submit_state = ?
WHERE p.room_id = ? AND p.id = ? AND s.submit_state = ? AND si.state = 'EXIST'
GROUP BY s.id;
`;

Expand Down

0 comments on commit 2a2e88c

Please sign in to comment.