Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
202bf17
docs: pr 템플릿 설정
oroi2009 Jul 11, 2025
d5e97b2
✨ feat: 프로젝트 기초 세팅
oroi2009 Jul 12, 2025
d43bd5c
♻️ refacotr : 코드 수정
oroi2009 Jul 18, 2025
6d6e3a6
✨ feat : 로그인 API 구현
oroi2009 Jul 20, 2025
5bd0de1
♻️ refactor : 코드 수정
oroi2009 Jul 20, 2025
fc1a79e
♻️ refactor : JWT 관련 삭제
oroi2009 Aug 5, 2025
31fc2c4
♻️ refactor : member 도메인 삭제
oroi2009 Aug 10, 2025
019a582
:recycle: refactor: 사용하지 않는 CustomMemberDetails 삭제
frombunny Aug 11, 2025
efec916
✨ feat : 맞춤 추천용 메뉴 목록 조회 API 구현
oroi2009 Aug 11, 2025
cbfc47b
🐛 fix : 중복 반찬 반환 버그 수정
oroi2009 Aug 11, 2025
01b0f7e
Merge branch 'main' into feat/#6
oroi2009 Aug 11, 2025
fc0af50
♻️ refactor : 정렬 코드 리팩토링
oroi2009 Aug 11, 2025
8fb004b
♻️ refactor : 깃충돌 수정
oroi2009 Aug 11, 2025
d6ed155
:construction_worker: CI: 워크플로우 작성
frombunny Aug 11, 2025
ecb6191
♻️ refactor : 코드 리팩토링
oroi2009 Aug 12, 2025
952d02d
✨ feat : 맞춤 추천용 메뉴 목록 조회 API
oroi2009 Aug 12, 2025
b1d37fb
✨ feat : 특정 메뉴를 파는 가게 조회 API 구현
oroi2009 Aug 12, 2025
2309aeb
:fire: chore: 사용하지 않는 파일 삭제
frombunny Aug 12, 2025
08f9bdc
♻️ refactor : Res 네이밍 수정
oroi2009 Aug 12, 2025
d232b1f
♻️ refactor : Res 코드 리팩토링
oroi2009 Aug 12, 2025
79ab459
:construction_worker: CI: ci.yml 작성
frombunny Aug 12, 2025
84f1004
:construction_worker: CI: cd.yml 작성
frombunny Aug 12, 2025
0d92dee
:construction_worker: CI: Dockerfile 작성
frombunny Aug 12, 2025
67f87b2
👷 CI : CI/CD 파이프라인 구축
frombunny Aug 12, 2025
85177ef
:green_heart: CI: ci 후에 cd가 진행될 수 있도록 수정
frombunny Aug 12, 2025
275eb83
:green_heart: CI: ci에서 job 간의 아티팩트를 전달할 수 있도록 수정
frombunny Aug 12, 2025
d6f88b2
💚 CI: CI/CD 파이프라인 설정 수정
frombunny Aug 12, 2025
fb04c45
:green_heart: CI. cd 실행 시, 환경변수가 적용되지 않는 문제 해결
frombunny Aug 12, 2025
806d4fc
:green_heart: CI. cd 실행 시, 환경변수가 적용되지 않는 문제 해결
frombunny Aug 12, 2025
c1277fc
✨ feat : 특정 메뉴를 파는 가게 조회 API 구현
oroi2009 Aug 13, 2025
b7e64ea
✨ feat : 메뉴 상세 조회 API 구현
oroi2009 Aug 13, 2025
a5f087f
Merge branch 'main' into feat/#11
frombunny Aug 13, 2025
ec751f7
♻️ refactor : Req 관련 코드 리팩토링
oroi2009 Aug 13, 2025
8213712
Merge branch 'feat/#11' of https://github.com/2025-Likelion-Centralth…
oroi2009 Aug 13, 2025
8662baa
♻️ refactor : MenuErrorCode 리팩토링
oroi2009 Aug 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@Getter
@AllArgsConstructor
public enum MenuErrorCode implements BaseResponseCode {
MENU_NOT_FOUND("MENU_NOT_FOUND_404_1",404,"반경 내에 반찬 매물이 없습니다.");
MENU_NOT_FOUND("MENU_NOT_FOUND_404_1",404,"존재하지 않는 메뉴 입니다.");

private final String code;
private final int httpStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
import com.example.Centralthon.global.exception.BaseException;

public class MenuNotFoundException extends BaseException {
public MenuNotFoundException() {
super(MenuErrorCode.MENU_NOT_FOUND);
}
public MenuNotFoundException() {super(MenuErrorCode.MENU_NOT_FOUND);}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.example.Centralthon.domain.menu.service;

import com.example.Centralthon.domain.menu.web.dto.*;
import com.example.Centralthon.domain.menu.web.dto.NearbyMenusRes;
import com.example.Centralthon.domain.menu.web.dto.StoresByMenuRes;
import jakarta.validation.constraints.NotNull;
import java.util.List;

public interface MenuService {
List<NearbyMenusRes> nearbyMenus(double latitude, double longitude);

List<StoresByMenuRes> storesByMenu(String name, double lat, double lng);

List<MenuDetailsRes> details(MenuIdsReq menus);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import com.example.Centralthon.domain.menu.entity.Menu;
import com.example.Centralthon.domain.menu.exception.MenuNotFoundException;
import com.example.Centralthon.domain.menu.repository.MenuRepository;
import com.example.Centralthon.domain.menu.web.dto.NearbyMenusRes;
import com.example.Centralthon.domain.menu.web.dto.StoresByMenuRes;
import com.example.Centralthon.domain.menu.web.dto.*;
import com.example.Centralthon.domain.store.entity.Store;
import com.example.Centralthon.global.util.geo.BoundingBox;
import com.example.Centralthon.global.util.geo.GeoUtils;
Expand All @@ -13,6 +12,8 @@
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -75,4 +76,17 @@ public List<StoresByMenuRes> storesByMenu(String name, double lat, double lng) {
))
.toList();
}

@Override
@Transactional(readOnly=true)
public List<MenuDetailsRes> details(MenuIdsReq menus) {
List<Menu> menuList = menuRepository.findAllById(menus.getMenuIds());

if (menuList.isEmpty()) {throw new MenuNotFoundException();}

return menuList.stream()
.map(menu -> MenuDetailsRes.from(menu))
.toList();
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package com.example.Centralthon.domain.menu.web.controller;

import com.example.Centralthon.domain.menu.service.MenuService;

import com.example.Centralthon.domain.menu.web.dto.*;
import com.example.Centralthon.global.response.SuccessResponse;
import jakarta.validation.Valid;

import com.example.Centralthon.domain.menu.web.dto.NearbyMenusRes;
import com.example.Centralthon.domain.menu.web.dto.StoresByMenuRes;
import com.example.Centralthon.global.response.SuccessResponse;

import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -40,4 +46,12 @@ public ResponseEntity<SuccessResponse<List<StoresByMenuRes>>> storesByMenu(

return ResponseEntity.status(HttpStatus.OK).body(SuccessResponse.from(stores));
}

//메뉴 상세 조회
@PostMapping("/details")
public ResponseEntity<SuccessResponse<List<MenuDetailsRes>>> details(@RequestBody @Valid MenuIdsReq menus){
List<MenuDetailsRes> menuList = menuService.details(menus);

return ResponseEntity.status(HttpStatus.OK).body(SuccessResponse.from(menuList));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.example.Centralthon.domain.menu.web.dto;

import com.example.Centralthon.domain.menu.entity.Menu;
import com.example.Centralthon.domain.menu.entity.enums.MenuCategory;

import java.math.BigDecimal;
import java.math.RoundingMode;

public record MenuDetailsRes(
long menuId,
String name,
MenuCategory category,
int costPrice,
int salePrice,
int salePercent,
String storeName
) {
public static MenuDetailsRes from(Menu menu) {
return new MenuDetailsRes(
menu.getId(),
menu.getName(),
menu.getCategory(),
menu.getCostPrice(),
menu.getSalePrice(),
calculateDiscount(menu.getCostPrice(), menu.getSalePrice()),
menu.getStore().getName()
);
}

private static int calculateDiscount(int cost, int sale) {
return BigDecimal.valueOf(cost - sale)
.multiply(BigDecimal.valueOf(100))
.divide(BigDecimal.valueOf(cost), 0, RoundingMode.HALF_UP)
.intValue();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.Centralthon.domain.menu.web.dto;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import java.util.List;

@Getter
public class MenuIdsReq {
@NotEmpty(message = "menuIds 리스트가 비어있습니다.")
private List<@NotNull(message = "menuId는 null일 수 없습니다.") Long> menuIds;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;

import org.springframework.web.bind.MissingServletRequestParameterException;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public SuccessResponse(T data, BaseResponseCode baseResponseCode) {
this.data = data;
}

// 201 Created 응답
public static <T> SuccessResponse<T> created(T data) {
return new SuccessResponse<>(data, SuccessResponseCode.SUCCESS_CREATED);
}
Expand Down