Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 이미지 업로드 API 구현 (#390) #391

Merged
merged 6 commits into from
Apr 11, 2023

Conversation

hyun99999
Copy link
Member

@hyun99999 hyun99999 commented Mar 30, 2023

🌴 PR 요약

🌱 작업한 브랜치

🌱 작업한 내용

  • fix: 회원가입 API 수정 (#388) #389 PR 머지 후에 코드리뷰하시면 좀 더 편하지 않을까 싶습니당
  • judgeStatus 메서드의 성공시를 수정했습니다.
    • 일반적인 특별한 응답이 없는 서버 통신에서도 judgeStatus 를 사용하고, 반환 타입이 String 인 경우에도 사용하는데 이를 정적인 문자가 아닌 서버에서 넘겨주는 값을 반환하도록 하였습니다.
    • Util 은 이미 되어 있었음. 이전 pr에서 수정할때 빼먹어서 그런것 같습니다.
  • cardImageUpload() API 를 구현하였습니다. 명함 생성할 때 적용해보겠습니다.

참고사항

  • 이렇게 스웨거에서 표시되는데 코드를 다음과 같이 작성하였습니다.
let imageData = MultipartFormData(provider: .data(image.pngData() ?? Data()), name: "image", mimeType: "image/png")

// 이전 이미지 업로드 코드는 다음과 같았음
let imageData = MultipartFormData(provider: .data(image.pngData() ?? Data()), name: "image", fileName: "image", mimeType: "image/png")

// 그래서 fileName 과 mimeType 은 옵셔널이라서 fileName 은 안넣어봤고, mimeType 은 스웨거에서 보이길래 넣었습니다. 궁금해서 안넣어봤으니깐 해보고 원하는 결과가 안나오면 다시 수정해보겠습니당

스크린샷 2023-03-30 오전 11 32 35

📮 관련 이슈

- Util 은 이미 되어 있었음. 이전 pr에서 수정할때 빼먹어서 그런것 같습니다.
- 일반적인 특별한 응답이 없는 서버 통신에서도 judgeStatus 를 사용하고, 반환 타입이 String 인 경우에도 사용하는데 이를 정적인 문자가 아닌 서버에서 넘겨주는 값을 반환하도록 하였습니다.
@hyun99999 hyun99999 added Hyungyu 🐯 현규 교수님 작업 Feat 새로운 기능 구현 labels Mar 30, 2023
@hyun99999 hyun99999 requested a review from dlwns33 March 30, 2023 02:32
@hyun99999 hyun99999 self-assigned this Mar 30, 2023
@hyun99999 hyun99999 changed the title feat: 이미지 업로드 API 구현 feat: 이미지 업로드 API 구현 (#390) Mar 30, 2023
Copy link
Member

@dlwns33 dlwns33 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 +114 to +115
let imageData = MultipartFormData(provider: .data(image.pngData() ?? Data()), name: "image", mimeType: "image/png")
multiPartData.append(imageData)
Copy link
Member

Choose a reason for hiding this comment

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

설명 읽어봤습니당!

뭔가 filename을 포함하지 않는다면 제대로 업로드 되지 않을수도 있겠다는 생각이 들었어요
우리가 스웨거에서 파일을 입력할때는 그야말로 이미 컴퓨터에 존재하는 "png 파일"을 골라서 넣는거라 이미 파일명이 있겠지만,
실제로 사용자가 앱에서 업로드할때는 "파일" 이 아니라 사용자가 갤러리에 가지고 있는 "사진"을 png 파일로 우리가 변환해?주는거라 파일명을 따로 붙여줘야될수도 있겠다는 생각이 들었습니당

근데 이러고 파일 이름 안넣어도 되면 스껄

Copy link
Member Author

Choose a reason for hiding this comment

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

요것도 숫자랑 문자로 이루어진 HEIG 파일명이 존재하는거 같더라구용? 그리고 파라미터가 옵셔널이라서 일단 비워서 한번 테스트해보공!
문제가 있으면 이슈 만들어서 반영해보겠습니당! 고생하셨어요~ 스껄~

@hyun99999 hyun99999 merged commit d27d72d into TeamNADA:develop Apr 11, 2023
@hyun99999 hyun99999 deleted the feature/#390 branch April 11, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feat 새로운 기능 구현 Hyungyu 🐯 현규 교수님 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: 이미지 업로드 API 구현
2 participants