Skip to content

[Feat] 이미지 업로드 API 구현 및 질문/댓글 imageUrl 연동 #120

Description

@kkw610

기능 설명

이미지 업로드/조회 API

  • POST /api/images: 이미지 파일 업로드 → UUID 기반 파일명으로 저장 후 URL 반환
  • GET /api/images/{filename}: 저장된 이미지 파일 조회

질문/댓글 imageUrl 연동

  • CreateReq, CommentReq에 imageUrl 필드 추가
  • createQuestion(), createComment() 서비스 로직에 imageUrl 저장 반영

문제

질문/댓글 작성 시 이미지를 첨부할 수 있도록 기획되어 있으나,
현재 이미지 파일을 서버에 실제로 업로드하는 API가 없는 상태.

Question, QuestionComment 엔티티에 imageUrl 컬럼은 존재하지만
CreateReq, CommentReq에 imageUrl 필드가 없어 저장이 불가능한 상황.

사용 흐름

  1. POST /api/images 로 이미지 파일 전송
  2. 응답으로 받은 imageUrl을 질문/댓글 등록 요청 바디에 포함
  3. 이미지 없을 경우 imageUrl 필드 생략 또는 null 전달

작업 상세 내용

  • application.yml: file.upload-dir 설정 추가
  • QuestionReqDTO: CreateReq, CommentReq에 imageUrl 필드 추가
  • QuestionService: createQuestion(), createComment()에 imageUrl 반영
  • ImageController: 신규 생성 (업로드/조회 엔드포인트)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions