Skip to content

Commit

Permalink
MATE-131 : [CHORE] goods 패키지 분리 (#117)
Browse files Browse the repository at this point in the history
* MATE-131 : [CHORE] goods 패키지 분리

- 기존 goods 패키지 네이밍을 goodsReview 로 변경
- goods -> goodsPost, goodsReview 패키지로 분리
- 리뷰 관련 기능은 goodsReview 패키지로 이동

* MATE-131 : [TEST] goods 패키지 분리에 따른 import 문 수정

* MATE-131 : [TEST] goods 패키지 분리에 따른 테스트 코드 분리
  • Loading branch information
hongjeZZ authored Dec 31, 2024
1 parent 76caf43 commit 2a7606d
Show file tree
Hide file tree
Showing 47 changed files with 749 additions and 482 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.example.mate.common.response.PageResponse;
import com.example.mate.domain.constant.TeamInfo;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsChat.entity.GoodsChatRoom;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mate.domain.goodsChat.dto.response;

import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsChat.entity.GoodsChatRoom;
import com.example.mate.domain.member.entity.Member;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mate.domain.goodsChat.entity;

import com.example.mate.domain.goods.entity.Role;
import com.example.mate.domain.goodsPost.entity.Role;
import com.example.mate.domain.member.entity.Member;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.mate.domain.goodsChat.entity;

import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goods.entity.Role;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.Role;
import com.example.mate.domain.member.entity.Member;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mate.domain.goodsChat.repository;

import com.example.mate.domain.goods.entity.Role;
import com.example.mate.domain.goodsPost.entity.Role;
import com.example.mate.domain.goodsChat.entity.GoodsChatRoom;
import java.util.Optional;
import org.springframework.data.domain.Page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import com.example.mate.common.error.ErrorCode;
import com.example.mate.common.response.PageResponse;
import com.example.mate.domain.constant.MessageType;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goods.entity.Role;
import com.example.mate.domain.goods.entity.Status;
import com.example.mate.domain.goods.repository.GoodsPostRepository;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.Role;
import com.example.mate.domain.goodsPost.entity.Status;
import com.example.mate.domain.goodsPost.repository.GoodsPostRepository;
import com.example.mate.domain.goodsChat.dto.response.GoodsChatMessageResponse;
import com.example.mate.domain.goodsChat.dto.response.GoodsChatRoomResponse;
import com.example.mate.domain.goodsChat.dto.response.GoodsChatRoomSummaryResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
package com.example.mate.domain.goods.controller;
package com.example.mate.domain.goodsPost.controller;

import com.example.mate.common.response.ApiResponse;
import com.example.mate.common.response.PageResponse;
import com.example.mate.common.security.auth.AuthMember;
import com.example.mate.common.validator.ValidPageable;
import com.example.mate.domain.goods.dto.request.GoodsPostRequest;
import com.example.mate.domain.goods.dto.request.GoodsReviewRequest;
import com.example.mate.domain.goods.dto.response.GoodsPostResponse;
import com.example.mate.domain.goods.dto.response.GoodsPostSummaryResponse;
import com.example.mate.domain.goods.dto.response.GoodsReviewResponse;
import com.example.mate.domain.goods.service.GoodsService;
import com.example.mate.domain.goodsPost.dto.request.GoodsPostRequest;
import com.example.mate.domain.goodsPost.dto.response.GoodsPostResponse;
import com.example.mate.domain.goodsPost.dto.response.GoodsPostSummaryResponse;
import com.example.mate.domain.goodsPost.service.GoodsPostService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/api/goods")
@RequiredArgsConstructor
@Tag(name = "GoodsController", description = "굿즈거래 관련 API")
public class GoodsController {
@Tag(name = "GoodsPostController", description = "굿즈거래 판매글 관련 API")
public class GoodsPostController {

private final GoodsService goodsService;
private final GoodsPostService goodsPostService;

@PostMapping
@Operation(summary = "굿즈거래 판매글 등록", description = "굿즈거래 페이지에서 판매글을 등록합니다.")
Expand All @@ -38,7 +43,7 @@ public ResponseEntity<ApiResponse<GoodsPostResponse>> registerGoodsPost(
@Parameter(description = "판매글 등록 데이터", required = true) @Validated @RequestPart("data") GoodsPostRequest request,
@Parameter(description = "판매글 이미지 리스트", required = true) @RequestPart("files") List<MultipartFile> files
) {
GoodsPostResponse response = goodsService.registerGoodsPost(member.getMemberId(), request, files);
GoodsPostResponse response = goodsPostService.registerGoodsPost(member.getMemberId(), request, files);
return ResponseEntity.ok(ApiResponse.success(response));
}

Expand All @@ -50,7 +55,7 @@ public ResponseEntity<ApiResponse<GoodsPostResponse>> updateGoodsPost(
@Parameter(description = "수정할 판매글 데이터", required = true) @Validated @RequestPart("data") GoodsPostRequest request,
@Parameter(description = "수정할 첨부 파일 리스트", required = true) @RequestPart("files") List<MultipartFile> files
) {
GoodsPostResponse response = goodsService.updateGoodsPost(member.getMemberId(), goodsPostId, request, files);
GoodsPostResponse response = goodsPostService.updateGoodsPost(member.getMemberId(), goodsPostId, request, files);
return ResponseEntity.ok(ApiResponse.success(response));
}

Expand All @@ -59,23 +64,23 @@ public ResponseEntity<ApiResponse<GoodsPostResponse>> updateGoodsPost(
public ResponseEntity<Void> deleteGoodsPost(
@AuthenticationPrincipal AuthMember member,
@Parameter(description = "삭제할 판매글 ID", required = true) @PathVariable Long goodsPostId) {
goodsService.deleteGoodsPost(member.getMemberId(), goodsPostId);
goodsPostService.deleteGoodsPost(member.getMemberId(), goodsPostId);
return ResponseEntity.noContent().build();
}

@GetMapping("/{goodsPostId}")
@Operation(summary = "굿즈거래 판매글 상세 조회", description = "굿즈거래 판매글 상세 페이지에서 판매글을 조회합니다.")
public ResponseEntity<ApiResponse<GoodsPostResponse>> getGoodsPost(@Parameter(description = "조회할 판매글 ID", required = true)
@PathVariable Long goodsPostId) {
GoodsPostResponse response = goodsService.getGoodsPost(goodsPostId);
GoodsPostResponse response = goodsPostService.getGoodsPost(goodsPostId);
return ResponseEntity.ok(ApiResponse.success(response));
}

@GetMapping("/main")
@Operation(summary = "메인페이지 굿즈거래 판매글 조회", description = "메인 페이지에서 굿즈거래 판매글을 요약한 4개의 리스트를 조회합니다.")
public ResponseEntity<ApiResponse<List<GoodsPostSummaryResponse>>> getGoodsPostsMain(@Parameter(description = "팀 ID")
@RequestParam(required = false) Long teamId) {
List<GoodsPostSummaryResponse> responses = goodsService.getMainGoodsPosts(teamId);
List<GoodsPostSummaryResponse> responses = goodsPostService.getMainGoodsPosts(teamId);
return ResponseEntity.ok(ApiResponse.success(responses));
}

Expand All @@ -86,7 +91,7 @@ public ResponseEntity<ApiResponse<PageResponse<GoodsPostSummaryResponse>>> getGo
@Parameter(description = "카테고리") @RequestParam(required = false) String category,
@Parameter(description = "페이징 정보", required = true) @ValidPageable Pageable pageable
) {
PageResponse<GoodsPostSummaryResponse> pageGoodsPosts = goodsService.getPageGoodsPosts(teamId, category, pageable);
PageResponse<GoodsPostSummaryResponse> pageGoodsPosts = goodsPostService.getPageGoodsPosts(teamId, category, pageable);

return ResponseEntity.ok(ApiResponse.success(pageGoodsPosts));
}
Expand All @@ -98,18 +103,7 @@ public ResponseEntity<ApiResponse<Void>> completeGoodsPost(
@Parameter(description = "판매글 ID", required = true) @PathVariable Long goodsPostId,
@Parameter(description = "구매자 ID", required = true) @RequestParam Long buyerId
) {
goodsService.completeTransaction(member.getMemberId(), goodsPostId, buyerId);
goodsPostService.completeTransaction(member.getMemberId(), goodsPostId, buyerId);
return ResponseEntity.ok(ApiResponse.success(null));
}

@PostMapping("/{goodsPostId}/review")
@Operation(summary = "굿즈거래 후기 등록", description = "후기 페이지에서 굿즈거래 후기를 등록합니다.")
public ResponseEntity<ApiResponse<GoodsReviewResponse>> registerGoodsReview(
@AuthenticationPrincipal AuthMember member,
@Parameter(description = "판매글 ID", required = true) @PathVariable Long goodsPostId,
@Parameter(description = "후기 작성 데이터", required = true) @Validated @RequestBody GoodsReviewRequest request
) {
GoodsReviewResponse response = goodsService.registerGoodsReview(member.getMemberId(), goodsPostId, request);
return ResponseEntity.ok(ApiResponse.success(response));
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.example.mate.domain.goods.dto.request;
package com.example.mate.domain.goodsPost.dto.request;

import com.example.mate.common.validator.ValidEnum;
import com.example.mate.domain.goods.dto.response.LocationInfo;
import com.example.mate.domain.goods.entity.Category;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goodsPost.dto.response.LocationInfo;
import com.example.mate.domain.goodsPost.entity.Category;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.member.entity.Member;
import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.example.mate.domain.goods.dto.response;
package com.example.mate.domain.goodsPost.dto.response;

import com.example.mate.domain.constant.TeamInfo;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goods.entity.GoodsPostImage;
import com.example.mate.domain.goods.entity.Role;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.GoodsPostImage;
import com.example.mate.domain.goodsPost.entity.Role;
import java.util.List;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.mate.domain.goods.dto.response;
package com.example.mate.domain.goodsPost.dto.response;

import com.example.mate.domain.constant.TeamInfo;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mate.domain.goods.dto.response;
package com.example.mate.domain.goodsPost.dto.response;

import com.example.mate.domain.goods.entity.Location;
import com.example.mate.domain.goodsPost.entity.Location;
import jakarta.validation.constraints.NotEmpty;
import lombok.Builder;
import lombok.EqualsAndHashCode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mate.domain.goods.dto.response;
package com.example.mate.domain.goodsPost.dto.response;

import com.example.mate.domain.goods.entity.Role;
import com.example.mate.domain.goodsPost.entity.Role;
import com.example.mate.domain.member.entity.Member;
import lombok.AccessLevel;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mate.domain.goods.entity;
package com.example.mate.domain.goodsPost.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mate.domain.goods.entity;
package com.example.mate.domain.goodsPost.entity;

import com.example.mate.common.BaseTimeEntity;
import com.example.mate.domain.member.entity.Member;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mate.domain.goods.entity;
package com.example.mate.domain.goodsPost.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mate.domain.goods.entity;
package com.example.mate.domain.goodsPost.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mate.domain.goods.entity;
package com.example.mate.domain.goodsPost.entity;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.mate.domain.goods.entity;
package com.example.mate.domain.goodsPost.entity;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mate.domain.goods.repository;
package com.example.mate.domain.goodsPost.repository;

import com.example.mate.domain.goods.entity.GoodsPostImage;
import com.example.mate.domain.goodsPost.entity.GoodsPostImage;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.mate.domain.goods.repository;
package com.example.mate.domain.goodsPost.repository;

import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goods.entity.Status;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.Status;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.example.mate.domain.goods.repository;
package com.example.mate.domain.goodsPost.repository;

import com.example.mate.domain.goods.entity.Category;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goods.entity.Status;
import com.example.mate.domain.goodsPost.entity.Category;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.Status;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.example.mate.domain.goods.repository;
package com.example.mate.domain.goodsPost.repository;

import static com.example.mate.domain.goods.entity.QGoodsPost.goodsPost;
import static com.example.mate.domain.goodsPost.entity.QGoodsPost.goodsPost;

import com.example.mate.domain.goods.entity.Category;
import com.example.mate.domain.goods.entity.GoodsPost;
import com.example.mate.domain.goods.entity.Status;
import com.example.mate.domain.goodsPost.entity.Category;
import com.example.mate.domain.goodsPost.entity.GoodsPost;
import com.example.mate.domain.goodsPost.entity.Status;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.jpa.impl.JPAQuery;
import com.querydsl.jpa.impl.JPAQueryFactory;
Expand Down
Loading

0 comments on commit 2a7606d

Please sign in to comment.