Skip to content

5주차 미션 [루크]#5

Open
yujining3827 wants to merge 28 commits into
mainfrom
luke/week5
Open

5주차 미션 [루크]#5
yujining3827 wants to merge 28 commits into
mainfrom
luke/week5

Conversation

@yujining3827
Copy link
Copy Markdown
Collaborator

@yujining3827 yujining3827 commented Apr 29, 2026

🚩 관련 이슈


📌 구현 결과

  • Review, Mission, Member, Home API Controller 및 DTO 구조 구현

  • API 5개 엔드포인트 생성 + Swagger 연동 및 API 테스트 가능 상태 구성

    • POST /api/review image

    • GET /api/mission image

    • POST /api/mission/completed image

    • POST /api/signup image

    • GET /api/home/my image

  • ApiResponse 공통 응답 구조 적용

@Getter
@AllArgsConstructor
@JsonPropertyOrder({"isSuccess", "code", "message", "result"})
public class ApiResponse<T> {

    @JsonProperty("isSuccess")
    private final boolean isSuccess;

    @JsonProperty("code")
    private final String code;

    @JsonProperty("message")
    private final String message;

    @JsonProperty("result")
    private final T result;

    // 성공한 경우 (result 포함)
    public static <T> ApiResponse<T> onSuccess(T result) {
        return new ApiResponse<>(true, "COMMON200", "성공입니다.", result);
    }

    // 실패한 경우 (result 포함)
    public static <T> ApiResponse<T> onFailure(BaseErrorCode code, T result ) {
        return new ApiResponse<>(false, code.getCode(), code.getMessage(), result);
    }
}
  • JPA Entity 기본 설정 (@entity, @id) 추가 및 실행 오류 해결

❓ 리뷰 요청

  • Entity에 @Entity, @Id를 일괄 적용하여 실행 오류를 해결했는데, 이 방식이 적절한지 궁금합니다.

🤔 질문

  • 현재 단계에서 Service/Repository 없이 Controller + DTO 중심으로 API 구조를 먼저 구성하는 방식이 적절한지 궁금합니다.

💬 기타 공유 사항

  • 현재는 Service 및 Repository 계층이 없어 실제 DB 연동 없이 API 구조만 구현한 상태입니다.
  • 더미 데이터 또는 빈 응답을 통해 API 스펙에 맞는 응답 형태를 우선 구성하였습니다.


@yujining3827
Copy link
Copy Markdown
Collaborator Author

상단 루크 폴더로 구조로 만들어 올려뒀습니다 ,,!

Copy link
Copy Markdown
Member

@yangjiae12 yangjiae12 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 +14 to +15
@JsonProperty("isSuccess")
private final boolean isSuccess;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

boolean을 사용하실 경우 Jackson의 직렬화 과정에서 isSuccess와 success 필드가 중복 생성되기 때문에 Boolean으로 변경하시면 좋을 것 같습니다~

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.Member;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Member 엔티티 임포트 하려다가 잘못 임포트 된 것 같은데 삭제하시면 되겠습니다!

Comment on lines +12 to +17
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class MemberController {

@PostMapping("/signup")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API 경로가 현재는 /api/signup, /api/home/my로 되어 있는데, /api/v1/members/... 형태로 버전을 명시하고 리소스 중심적으로 설계하는 것이 좋습니다.

Comment on lines +10 to +20
public static class SignupDTO {
public String name;
public Gender gender;
public LocalDate birth;
public String addressLine1;
public String addressLine2;
public String email;
public String phoneNumber;
public UserType type;
public Long agreeId;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Validation과 Swagger 명세를 추가하면 좋을 것 같습니다!

Comment on lines +5 to +10
public static class CreateReviewDTO {
public Long marketId;
public Long regionId;
public Integer stars;
public String content;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

현재 CreateReviewDTO에 모든 ID를 담고 있는데, marketId는 Path Variable로 받고 나머지 리뷰 본문 데이터만 Request Body로 받는 방식이 좋을 것 같습니다! 또한 regionId의 경우 marketId를 통해 서버에서 조회 가능한 정보라면 중복으로 받지 않아도 될 것 같아요.

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.

2 participants