Skip to content

bug(graduate): 백엔드 DTO 구조, 필드명 변경 사항 반영 및 파일 미리보기 오류 수정#218

Merged
kim-subsub merged 4 commits intodevelopfrom
bug/217
Jan 8, 2026
Merged

bug(graduate): 백엔드 DTO 구조, 필드명 변경 사항 반영 및 파일 미리보기 오류 수정#218
kim-subsub merged 4 commits intodevelopfrom
bug/217

Conversation

@seoJing
Copy link
Copy Markdown
Contributor

@seoJing seoJing commented Jan 6, 2026

Summary

#217

Tasks

  • 백엔드 DTO 구조 변경 사항 반영
  • 백엔드 필드명 변경 사항 반영
  • 파일 미리보기 오류 수정
  • qa

To Reviewer

전체적인 오류 수정 완료했습니다.
axios 파일에서 요청의 baseURL(aics-api, aics-admin, aics-auth)을 결정하는 로직이 함수형 엔드포인트에서 정상적으로 작동하지 않는 점을 발견했습니다.

function getAllEndpointPaths(
  obj: (typeof END_POINT)[keyof typeof END_POINT],
): EndpointPath[] {
  const paths: EndpointPath[] = [];
  for (const key in obj) {
    const value = obj[key as keyof typeof obj];
    if (typeof value === 'string') {
      paths.push(value as EndpointPath);
    }
  }
  return paths;
}

function selectInstanceByRequest(request: EndpointPath): AxiosInstance {
  const authPaths = getAllEndpointPaths(END_POINT.AUTH);
  if (authPaths.some(path => request === path || request.startsWith(path))) {
    return authInstance;
  }

  const adminPaths = getAllEndpointPaths(END_POINT.ADMIN);
  if (
    adminPaths.length > 0 &&
    adminPaths.some(path => request === path || request.startsWith(path))
  ) {
    return adminInstance;
  }

  return userInstance;
}

이게 기존 로직인데, 문제는 if (typeof value === 'string') 이 함수형 엔드포인트는 제대로 처리를 하지 못해서, paths에 함수형 엔드포인트를 넣지 못한 것 부터 발생합니다.

그렇게 특정 path(어드민, 유저, 어스) 그룹에 함수형 엔드포인트가 들어가지 못한 상황에서,

만약 자격증 파일 조회를 한다면, 기대 로직은 selectInstanceByRequest/api/v1/admin/certificate/1 요청을 getAllEndpointPaths으로 받아온 /api/v1/admin/certificate와 비교하여, adminInstance(baseURL: aics-admin)를 사용하는 것인데.

실제 작동은 함수형 엔드포인트를 path에 담아두지 못하여, 비교가 X > if문 다 지나가고 userInstance 접두사를 달아줌 > 잘못된 서버로 요청 > 404 Not Found

따라서 이런 로직은 그냥

function selectInstanceByRequest(request: EndpointPath): AxiosInstance {
  if (request.startsWith('/api/v1/auth/')) {
    return authInstance;
  }

  if (request.startsWith('/api/v1/admin/')) {
    return adminInstance;
  }

  return userInstance;
}

으로 간략화 시켜 해결했습니다.

기존 방식보단 직접적으로 문자열이 노출되는게 조금 걸리는데요. 더 좋은 방법이 있을 듯 합니다.

Screenshot

녹음 2026-01-06 235415

@seoJing seoJing self-assigned this Jan 6, 2026
@seoJing seoJing requested a review from a team as a code owner January 6, 2026 14:57
@seoJing seoJing added the bug Something isn't working label Jan 6, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
aics-admin Ready Ready Preview, Comment Jan 6, 2026 2:57pm
aics-client Ready Ready Preview, Comment Jan 6, 2026 2:57pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kim-subsub kim-subsub merged commit 2bf660a into develop Jan 8, 2026
7 checks passed
@kim-subsub kim-subsub deleted the bug/217 branch January 8, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants