Skip to content

Conversation

@KingNono1030
Copy link
Contributor

@KingNono1030 KingNono1030 commented Nov 30, 2024

📌 PR 템플릿

🏷️ PR 타입 (PR Type)

아래 해당 사항에 체크해 주세요.

  • 🐛 버그 수정 (Bugfix)
  • ✨ 기능 개발 (Feature)
  • 🎨 코드 스타일 변경 (Code style update) - 포매팅, 로컬 변수 등
  • ♻️ 리팩토링 (Refactoring) - 기능 변화 없음, API 변경 없음
  • 🛠️ 빌드 관련 변경 (Build related changes)
  • 📝 문서 내용 변경 (Documentation)
  • 🔄 기타 (Other) - 설명 작성

📝 요약 (Summary)

PR의 목적과 간단한 설명을 적어주세요.

백엔드 작업 상황에 따라 api 관련 타입들의 업데이트 작업


🔍 상세 내용 (Describe your changes)

변경 사항을 구체적으로 작성해 주세요.

  • 주요 변경점 예시: "버튼 스타일 변경" 등

🔗 관련 이슈 또는 링크 (Issue Number or Link)

이슈 번호나 관련 링크가 있다면 추가해 주세요.


✅ 체크리스트 (Checklist)

PR 작성 시 아래 사항들을 점검해 주세요.

  • 빌드가 성공적으로 되었나요?
  • 코드에 주석을 추가했나요?
  • 모든 테스트가 통과했나요?
  • 관련 문서가 업데이트되었나요?

📸 스크린샷 (선택 사항)

변경 사항이 UI와 관련이 있다면 스크린샷을 추가해 주세요.

image
빌드 성공

// 파일 업로드가 요구되는 경우
interface MultipartFormData<T> {
  request: T
  file?: File
}

// 포트폴리오 생성 요청 타입
export type PortfolioCreateRequest = MultipartFormData<PortfolioDetail>

// PATCH:  마이페이지 프로필 저장
export type ProfileUpdateRequest = MultipartFormData<ProfileBase>

📝 기타 사항

PR과 관련된 기타 사항이 있다면 적어주세요.

@KingNono1030 KingNono1030 self-assigned this Nov 30, 2024
Copy link
Contributor

@yellowjang yellowjang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입에 대한 빠른 업뎃 감사합니다! 고생하셨습니다 :)

Comment on lines +61 to +76
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** 닉네임 중복 체크 */
post: operations['checkNicknameDuplicate']
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'never' 타입을 적용하는 건 처음 보네요! 찾아보니
의 용도로 사용한다고 하는군요.. 덕분에 never 타입에 대해 알아갑니다!
그러면 타입 스크립트에서 타입 지정이 필요없을 때 ? 사용하는 것 같은데,
정확히 어떤 목적으로 사용되는 건지 알려주실 수 있나요 ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ApiSchema.types.d.ts 파일 같은 경우 제가 openapi-typescript 라는 도구를 사용하여 민지님이 작업해주신 스펙에 있는 타입을 그대로 타입스크립트 파일로 생성한 결과물입니다 !

my-page-check-nickname 엔드포인트에서는 post 메서드만 있고 나머지의 경우는 없고, 다른 요구하는 쿼리 등이 없어서 never 로 타입이 변환된 듯 하네요.
http://43.202.50.174:8080/v3/api-docs 실제 스펙에서는 never 로 지정되어 있지 않지만, 특정 엔드포인트에서 존재하지 않는 요청에 대해서 타입스크립트로 변환할 때 never 타입으로 자동 생성된 듯 합니다 !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 ㅎㅎ 민지님께서 작업해주신 것을 바탕으로 타입을 생성해주셔서 그런 거군요! 감사합니다 ~

Comment on lines +99 to 103
// 포트폴리오 리스트 조회
export interface PortfolioDetail extends PortfolioBase {
portContent: string // 상세 내용
techStacks: TechStack[] // 사용 기술 스택
links?: PortfolioLink[] // 외부 링크
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전부터 느꼈지만, 여러 번 재사용되는 타입을 기본 base 타입을 지정해두고, extends 하니 여러번 정의해줘야하는 번거로움을 피할 수 있어서 정말 좋네요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 맞아요 !

@KingNono1030 KingNono1030 merged commit eef8602 into dev Dec 1, 2024
2 of 3 checks passed
@KingNono1030 KingNono1030 deleted the chore/update-api-related-types branch December 1, 2024 10:51
@KingNono1030 KingNono1030 restored the chore/update-api-related-types branch December 3, 2024 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants