Merge pull request 'refactor: 지붕재 적합성 main만 있고 detial은 없는 경우 방어처리' (#91) from feature/suitable into dev
Reviewed-on: #91
This commit is contained in:
commit
0355a8f4ef
@ -37,7 +37,7 @@ async function createSuitablePdf(request: NextRequest): Promise<NextResponse> {
|
||||
const fileTitle = formData.get('fileTitle') as string
|
||||
|
||||
/* 파라미터 체크 */
|
||||
if (ids === '' || detailIds === '' || fileTitle === '') {
|
||||
if (ids === '' || fileTitle === '') {
|
||||
return NextResponse.json({ error: '필수 파라미터가 누락되었습니다' }, { status: HttpStatusCode.BadRequest })
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ async function createSuitablePdf(request: NextRequest): Promise<NextResponse> {
|
||||
, msd_json.memo
|
||||
FROM ms_suitable_detail msd_json
|
||||
WHERE msd.main_id = msd_json.main_id
|
||||
AND msd_json.id IN (:detailIds)
|
||||
--detailIds AND msd_json.id IN (:detailIds)
|
||||
FOR JSON PATH
|
||||
) AS detail
|
||||
FROM ms_suitable_detail msd
|
||||
@ -85,7 +85,10 @@ async function createSuitablePdf(request: NextRequest): Promise<NextResponse> {
|
||||
|
||||
/* 검색 조건 설정 */
|
||||
query = query.replaceAll(':mainIds', ids)
|
||||
query = query.replaceAll(':detailIds', detailIds)
|
||||
if (detailIds) {
|
||||
query = query.replace('--detailIds', '')
|
||||
query = query.replace(':detailIds', detailIds)
|
||||
}
|
||||
|
||||
/* 데이터 조회 */
|
||||
const suitable: Suitable[] = await prisma.$queryRawUnsafe(query)
|
||||
|
||||
@ -310,7 +310,7 @@ export function useSuitable() {
|
||||
inputFileTitle.value = fileTitle
|
||||
|
||||
form.appendChild(inputIds)
|
||||
form.appendChild(inputDetailIds)
|
||||
if (detailIds) form.appendChild(inputDetailIds)
|
||||
form.appendChild(inputFileTitle)
|
||||
document.body.appendChild(form)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user