Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@RequiredArgsConstructor
public class MenuController implements MenuControllerDocs {


private final MenuService menuService;


Expand All @@ -44,16 +45,23 @@ public ResponseEntity<List<MenuResponse>> getAllMenusByCategoryId(

}

@Override
@LogMonitoringInvocation
@GetMapping("/cafeteria/{cafeteria-id}")
public ResponseEntity<List<MenuResponse>> getAllMenusByCafeteriaId(
@PathVariable(name = "cafeteria-id") Long cafeteriaId
) {
return ResponseEntity.ok(menuService.getAllMenusByCafeteriaId(cafeteriaId));
}
@Override
@LogMonitoringInvocation
@GetMapping("/{menuId}")
public ResponseEntity<MenuResponse> getMenuById(@PathVariable Long menuId){
return ResponseEntity.ok(menuService.getMenuById(menuId));
}

@Override
@Override
@LogMonitoringInvocation
@GetMapping("/cafeteria/{cafeteria-id}")
public ResponseEntity<List<MenuResponse>> getAllMenusByCafeteriaId(
@PathVariable(name = "cafeteria-id") Long cafeteriaId
) {
return ResponseEntity.ok(menuService.getAllMenusByCafeteriaId(cafeteriaId));
}

@Override
@PostMapping
@LogMonitoringInvocation
public ResponseEntity<MenuResponse> createMenu(@Valid @RequestBody MenuRequest createRequest){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,112 @@

import java.util.List;

@Tag(name = "Menu Management", description = "메뉴 CURD 및 조회 API")
/**
* 메뉴 관리 시스템의 API 명세를 정의하는 인터페이스입니다.
* 메뉴의 등록, 수정, 삭제 및 다양한 조건별 조회 기능을 제공합니다.
*/
@Tag(name = "Menu Management", description = "메뉴 CRUD 및 조회 API")
public interface MenuControllerDocs {

@Operation(summary = "메뉴 전체 조회", description = "모든 메뉴 목록을 조회합니다.")
@ApiResponse(responseCode = "200", description = "조회 성공")
ResponseEntity<List<MenuResponse>> getAllMenus();
/**
* 시스템에 등록된 모든 메뉴 목록을 조회합니다.
* * @return 메뉴 정보 리스트를 담은 ResponseEntity
*/
@Operation(summary = "메뉴 전체 조회", description = "모든 메뉴 목록을 조회합니다.")
@ApiResponse(responseCode = "200", description = "조회 성공")
ResponseEntity<List<MenuResponse>> getAllMenus();
Comment on lines +25 to +31
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Javadoc 형식 오류를 수정하세요.

Line 27에서 * * @return 대신 * @return으로 작성해야 합니다. 여분의 별표가 포함되어 있습니다.

   * 시스템에 등록된 모든 메뉴 목록을 조회합니다.
-  * * @return 메뉴 정보 리스트를 담은 ResponseEntity
+  * @return 메뉴 정보 리스트를 담은 ResponseEntity
   */
🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 25 to 31, the Javadoc for the method contains an extra asterisk
sequence ("* * @return") on line 27; remove the extra asterisk so the Javadoc
tag reads " * @return" (single leading asterisk and a space before @return) to
restore proper Javadoc formatting and alignment.


@Operation(summary = "카테고리별 메뉴 조회", description = "특정 카테고리 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 카테고리를 찾을 수 없습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCategoryId(
@Parameter(description = "조회할 카테고리 ID", example = "1")
Long categoryId
);
/**
* 고유 식별자를 통해 단일 메뉴의 상세 정보를 조회합니다.
* * @param menuId 조회하고자 하는 메뉴의 ID
* @return 해당 메뉴의 상세 정보를 담은 ResponseEntity
*/
@Operation(summary = "단일 메뉴 상세 조회", description = "특정 ID에 해당하는 메뉴의 상세 정보를 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> getMenuById(
@Parameter(description = "조회할 메뉴 ID", example = "1") Long menuId
);
Comment on lines +33 to +46
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Javadoc 형식 오류를 수정하세요.

Line 35에서 * * @param 대신 * @param으로 작성해야 합니다. 여분의 별표가 포함되어 있습니다.

   * 고유 식별자를 통해 단일 메뉴의 상세 정보를 조회합니다.
-  * * @param menuId 조회하고자 하는 메뉴의 ID
+  * @param menuId 조회하고자 하는 메뉴의 ID
   * @return 해당 메뉴의 상세 정보를 담은 ResponseEntity

그 외 API 문서화는 잘 작성되었습니다.

🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 33 to 46, the Javadoc for getMenuById contains an extra asterisk in
the param tag ("* * @param") which breaks Javadoc formatting; remove the extra
asterisk so the tag reads " * @param menuId 조회하고자 하는 메뉴의 ID" (i.e., a single
leading " * " before @param) and ensure the Javadoc block alignment remains
consistent.


@Operation(summary = "식당별 메뉴 조회", description = "식당 ID에 해당하는 메뉴 목록을 조회합니다.")
ResponseEntity<List<MenuResponse>> getAllMenusByCafeteriaId(
@Parameter(description = "조회할 식당 ID", example = "1")
Long cafeteriaId
);
/**
* 특정 카테고리에 속한 모든 메뉴를 조회합니다.
* * @param categoryId 카테고리 고유 식별자
* @return 해당 카테고리의 메뉴 리스트를 담은 ResponseEntity
*/
@Operation(summary = "카테고리별 메뉴 조회", description = "특정 카테고리 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 카테고리를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCategoryId(
@Parameter(description = "조회할 카테고리 ID", example = "1") Long categoryId
);
Comment on lines +48 to +61
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Javadoc 형식 오류를 수정하세요.

Line 50에서 * * @param 대신 * @param으로 작성해야 합니다.

   * 특정 카테고리에 속한 모든 메뉴를 조회합니다.
-  * * @param categoryId 카테고리 고유 식별자
+  * @param categoryId 카테고리 고유 식별자
   * @return 해당 카테고리의 메뉴 리스트를 담은 ResponseEntity
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* 특정 카테고리에 속한 모든 메뉴를 조회합니다.
* * @param categoryId 카테고리 고유 식별자
* @return 해당 카테고리의 메뉴 리스트를 담은 ResponseEntity
*/
@Operation(summary = "카테고리별 메뉴 조회", description = "특정 카테고리 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 카테고리를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCategoryId(
@Parameter(description = "조회할 카테고리 ID", example = "1") Long categoryId
);
/**
* 특정 카테고리에 속한 모든 메뉴를 조회합니다.
* @param categoryId 카테고리 고유 식별자
* @return 해당 카테고리의 메뉴 리스트를 담은 ResponseEntity
*/
@Operation(summary = "카테고리별 메뉴 조회", description = "특정 카테고리 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 카테고리를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCategoryId(
@Parameter(description = "조회할 카테고리 ID", example = "1") Long categoryId
);
🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 48 to 61, the Javadoc has a stray extra asterisk sequence ("* *
@param") on line 50; replace it with the correct single-asterisk Javadoc tag
format (" * @param") so the param tag is properly recognized and align the
leading asterisks for the Javadoc block to match the other lines.


@Operation(
summary = "신규 메뉴 생성 (관리자 전용)",
description = "새로운 메뉴를 등록합니다."
)
@ApiResponses({
@ApiResponse(responseCode = "201", description = "메뉴 생성 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류(이름/가격/사용 가능)",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "409", description = "해당 카테고리에 이미 존재하는 메뉴입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> createMenu(MenuRequest menuRequest);
/**
* 특정 식당에서 제공하는 모든 메뉴를 조회합니다.
* * @param cafeteriaId 식당 고유 식별자
* @return 해당 식당의 메뉴 리스트를 담은 ResponseEntity
*/
@Operation(summary = "식당별 메뉴 조회", description = "식당 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 식당을 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCafeteriaId(
@Parameter(description = "조회할 식당 ID", example = "1") Long cafeteriaId
);
Comment on lines +63 to +76
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Javadoc 형식 오류를 수정하세요.

Line 65에서 * * @param 대신 * @param으로 작성해야 합니다.

   * 특정 식당에서 제공하는 모든 메뉴를 조회합니다.
-  * * @param cafeteriaId 식당 고유 식별자
+  * @param cafeteriaId 식당 고유 식별자
   * @return 해당 식당의 메뉴 리스트를 담은 ResponseEntity
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* 특정 식당에서 제공하는 모든 메뉴를 조회합니다.
* * @param cafeteriaId 식당 고유 식별자
* @return 해당 식당의 메뉴 리스트를 담은 ResponseEntity
*/
@Operation(summary = "식당별 메뉴 조회", description = "식당 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 식당을 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCafeteriaId(
@Parameter(description = "조회할 식당 ID", example = "1") Long cafeteriaId
);
/**
* 특정 식당에서 제공하는 모든 메뉴를 조회합니다.
* @param cafeteriaId 식당 고유 식별자
* @return 해당 식당의 메뉴 리스트를 담은 ResponseEntity
*/
@Operation(summary = "식당별 메뉴 조회", description = "식당 ID에 해당하는 메뉴 목록을 조회합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "404", description = "해당 식당을 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<List<MenuResponse>> getAllMenusByCafeteriaId(
@Parameter(description = "조회할 식당 ID", example = "1") Long cafeteriaId
);
🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 63 to 76, the Javadoc has a malformed asterisk sequence ("* *
@param") on line 65; replace it with a proper single-space Javadoc tag line (" *
@param cafeteriaId ...") so the Javadoc block is syntactically correct and the
@param is recognized.


@Operation(
summary = "메뉴 정보 수정(관리자 전용)",
description = "특정 ID의 메뉴 정보를 수정합니다."
)
@ApiResponses({
@ApiResponse(responseCode = "200", description = "메뉴 수정 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류" ,
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> updateMenu(
@Parameter(description = "수정할 메뉴의 ID", example = "1")
Long menuId,
MenuUpdateRequest menuUpdateRequest
);
/**
* 새로운 메뉴를 시스템에 등록합니다. (관리자 권한 필요)
* * @param menuRequest 생성할 메뉴의 상세 정보 DTO
* @return 생성된 메뉴 정보를 담은 ResponseEntity
*/
@Operation(summary = "신규 메뉴 생성 (관리자 전용)", description = "새로운 메뉴를 등록합니다.")
@ApiResponses({
@ApiResponse(responseCode = "201", description = "메뉴 생성 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류(이름/가격 등)",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "409", description = "이미 존재하는 메뉴입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> createMenu(MenuRequest menuRequest);
Comment on lines +78 to +91
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find MenuControllerDocs.java and check line 80 for the Javadoc issue
find . -name "MenuControllerDocs.java" -type f | head -5

Repository: CampusTable/campus-table-be

Length of output: 152


🏁 Script executed:

#!/bin/bash
# Read the MenuControllerDocs.java file, focusing on lines 78-91
cat -n ./src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java | sed -n '75,95p'

Repository: CampusTable/campus-table-be

Length of output: 1062


🏁 Script executed:

#!/bin/bash
# Find and examine MenuController.java for security annotations on createMenu
find . -name "MenuController.java" -type f

Repository: CampusTable/campus-table-be

Length of output: 148


🏁 Script executed:

#!/bin/bash
# Check MenuController.java for createMenu method and security annotations
cat -n ./src/main/java/com/campustable/be/domain/menu/controller/MenuController.java | grep -A 10 -B 5 "createMenu"

Repository: CampusTable/campus-table-be

Length of output: 850


🏁 Script executed:

#!/bin/bash
# Search for security annotations in MenuController.java
rg -n "@PreAuthorize|@Secured|@RolesAllowed" ./src/main/java/com/campustable/be/domain/menu/controller/MenuController.java

Repository: CampusTable/campus-table-be

Length of output: 53


🏁 Script executed:

#!/bin/bash
# Check the entire MenuController.java file for any security-related annotations and class declaration
cat -n ./src/main/java/com/campustable/be/domain/menu/controller/MenuController.java | head -80

Repository: CampusTable/campus-table-be

Length of output: 3162


Javadoc 형식 오류를 수정하세요.

Line 80에서 * * @param 대신 * @param으로 작성해야 합니다.

   * 새로운 메뉴를 시스템에 등록합니다. (관리자 권한 필요)
-  * * @param menuRequest 생성할 메뉴의 상세 정보 DTO
+  * @param menuRequest 생성할 메뉴의 상세 정보 DTO
   * @return 생성된 메뉴 정보를 담은 ResponseEntity

MenuController의 createMenu, updateMenu, deleteMenu 메서드에 보안 애노테이션이 누락되어 있습니다.

인터페이스(MenuControllerDocs)에서는 관리자 권한이 필요함을 명시하고 있으나, 실제 구현체(MenuController)에는 @PreAuthorize, @Secured, 또는 @RolesAllowed 같은 보안 애노테이션이 적용되지 않았습니다. 관리자만 접근할 수 있도록 적절한 보안 애노테이션을 추가하세요.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* 새로운 메뉴를 시스템에 등록합니다. (관리자 권한 필요)
* * @param menuRequest 생성할 메뉴의 상세 정보 DTO
* @return 생성된 메뉴 정보를 담은 ResponseEntity
*/
@Operation(summary = "신규 메뉴 생성 (관리자 전용)", description = "새로운 메뉴를 등록합니다.")
@ApiResponses({
@ApiResponse(responseCode = "201", description = "메뉴 생성 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류(이름/가격 등)",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "409", description = "이미 존재하는 메뉴입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> createMenu(MenuRequest menuRequest);
/**
* 새로운 메뉴를 시스템에 등록합니다. (관리자 권한 필요)
* @param menuRequest 생성할 메뉴의 상세 정보 DTO
* @return 생성된 메뉴 정보를 담은 ResponseEntity
*/
@Operation(summary = "신규 메뉴 생성 (관리자 전용)", description = "새로운 메뉴를 등록합니다.")
@ApiResponses({
@ApiResponse(responseCode = "201", description = "메뉴 생성 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류(이름/가격 등)",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "409", description = "이미 존재하는 메뉴입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> createMenu(MenuRequest menuRequest);
🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 78-91, fix the Javadoc formatting by replacing the stray "* *
@param" with a single "* @param" on line 80; additionally, ensure the actual
controller implementation
(src/main/java/com/campustable/be/domain/menu/controller/MenuController.java)
applies an admin-only security annotation to the createMenu, updateMenu, and
deleteMenu methods (for example add @PreAuthorize("hasRole('ADMIN')") or
@RolesAllowed("ROLE_ADMIN") to each method or the class) and import the
corresponding security annotation and enable method security if not already
configured.


@Operation(
summary = "메뉴 삭제 (관리자 전용)",
description = "특정 ID의 메뉴를 삭제 합니다."
)
@ApiResponses({
@ApiResponse(responseCode = "204", description = "메뉴 삭제 성공"),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<Void> deleteMenu(
@Parameter(description = "삭제할 메뉴의 ID", example = "1")
Long menuId
);
}
/**
* 기존 메뉴 정보를 수정합니다. (관리자 권한 필요)
* * @param menuId 수정할 메뉴의 ID
* @param menuUpdateRequest 수정할 내용이 담긴 DTO
* @return 수정 완료된 메뉴 정보를 담은 ResponseEntity
*/
@Operation(summary = "메뉴 정보 수정 (관리자 전용)", description = "특정 ID의 메뉴 정보를 수정합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "메뉴 수정 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> updateMenu(
@Parameter(description = "수정할 메뉴 ID", example = "1") Long menuId,
MenuUpdateRequest menuUpdateRequest
);
Comment on lines +93 to +110
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Javadoc 형식 오류를 수정하세요.

Line 95에서 * * @param 대신 * @param으로 작성해야 합니다.

   * 기존 메뉴 정보를 수정합니다. (관리자 권한 필요)
-  * * @param menuId 수정할 메뉴의 ID
+  * @param menuId 수정할 메뉴의 ID
   * @param menuUpdateRequest 수정할 내용이 담긴 DTO
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* 기존 메뉴 정보를 수정합니다. (관리자 권한 필요)
* * @param menuId 수정할 메뉴의 ID
* @param menuUpdateRequest 수정할 내용이 담긴 DTO
* @return 수정 완료된 메뉴 정보를 담은 ResponseEntity
*/
@Operation(summary = "메뉴 정보 수정 (관리자 전용)", description = "특정 ID의 메뉴 정보를 수정합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "메뉴 수정 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> updateMenu(
@Parameter(description = "수정할 메뉴 ID", example = "1") Long menuId,
MenuUpdateRequest menuUpdateRequest
);
/**
* 기존 메뉴 정보를 수정합니다. (관리자 권한 필요)
* @param menuId 수정할 메뉴의 ID
* @param menuUpdateRequest 수정할 내용이 담긴 DTO
* @return 수정 완료된 메뉴 정보를 담은 ResponseEntity
*/
@Operation(summary = "메뉴 정보 수정 (관리자 전용)", description = "특정 ID의 메뉴 정보를 수정합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "메뉴 수정 성공"),
@ApiResponse(responseCode = "400", description = "입력값 오류",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<MenuResponse> updateMenu(
@Parameter(description = "수정할 메뉴 ID", example = "1") Long menuId,
MenuUpdateRequest menuUpdateRequest
);
🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 93 to 110, the Javadoc has a formatting typo on line 95 where `* *
@param` is used; replace it with a single leading asterisk and a space so it
reads ` * @param` and ensure all @param tags are properly aligned (each starts
with " * @param") and the Javadoc block remains syntactically correct.


/**
* 특정 메뉴를 시스템에서 삭제합니다. (관리자 권한 필요)
* * @param menuId 삭제할 메뉴의 ID
* @return 삭제 성공 시 빈 바디를 담은 ResponseEntity (204 No Content)
*/
@Operation(summary = "메뉴 삭제 (관리자 전용)", description = "특정 ID의 메뉴를 삭제합니다.")
@ApiResponses({
@ApiResponse(responseCode = "204", description = "메뉴 삭제 성공"),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<Void> deleteMenu(
@Parameter(description = "삭제할 메뉴 ID", example = "1") Long menuId
);
Comment on lines +112 to +125
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Javadoc 형식 오류를 수정하세요.

Line 114에서 * * @param 대신 * @param으로 작성해야 합니다.

   * 특정 메뉴를 시스템에서 삭제합니다. (관리자 권한 필요)
-  * * @param menuId 삭제할 메뉴의 ID
+  * @param menuId 삭제할 메뉴의 ID
   * @return 삭제 성공 시 빈 바디를 담은 ResponseEntity (204 No Content)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* 특정 메뉴를 시스템에서 삭제합니다. (관리자 권한 필요)
* * @param menuId 삭제할 메뉴의 ID
* @return 삭제 성공 바디를 담은 ResponseEntity (204 No Content)
*/
@Operation(summary = "메뉴 삭제 (관리자 전용)", description = "특정 ID의 메뉴를 삭제합니다.")
@ApiResponses({
@ApiResponse(responseCode = "204", description = "메뉴 삭제 성공"),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<Void> deleteMenu(
@Parameter(description = "삭제할 메뉴 ID", example = "1") Long menuId
);
/**
* 특정 메뉴를 시스템에서 삭제합니다. (관리자 권한 필요)
* @param menuId 삭제할 메뉴의 ID
* @return 삭제 성공 바디를 담은 ResponseEntity (204 No Content)
*/
@Operation(summary = "메뉴 삭제 (관리자 전용)", description = "특정 ID의 메뉴를 삭제합니다.")
@ApiResponses({
@ApiResponse(responseCode = "204", description = "메뉴 삭제 성공"),
@ApiResponse(responseCode = "404", description = "해당 메뉴를 찾을 수 없습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
ResponseEntity<Void> deleteMenu(
@Parameter(description = "삭제할 메뉴 ID", example = "1") Long menuId
);
🤖 Prompt for AI Agents
In
src/main/java/com/campustable/be/domain/menu/controller/MenuControllerDocs.java
around lines 112 to 125, the Javadoc has a formatting typo on line 114 where "`*
* @param`" is used; replace it with a single leading asterisk and space followed
by "@param" (i.e. " * @param") so the Javadoc block is correctly formatted;
ensure the rest of the Javadoc alignment and spacing remain consistent and
re-run javadoc/lint to confirm the warning is resolved.

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class MenuRequest {
@Min(value = 0, message = "가격은 0원 이상이어야 합니다.")
private Integer price;

@NotBlank(message = "이미지를 위한url은 필수입니다.")
private String menuUrl;

@NotNull(message = "판매 가능 여부는 필수입니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@
import com.campustable.be.domain.menu.dto.MenuUpdateRequest;
import com.campustable.be.domain.menu.entity.Menu;
import com.campustable.be.domain.menu.repository.MenuRepository;
import com.campustable.be.global.aop.LogMonitoringInvocation;
import com.campustable.be.global.exception.CustomException;
import com.campustable.be.global.exception.ErrorCode;
import java.util.ArrayList;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.propertyeditors.CustomNumberEditor;
import org.springframework.transaction.annotation.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;

Expand All @@ -41,7 +37,7 @@ public MenuResponse createMenu(MenuRequest request) {
Category category = categoryRepository.findById(request.getCategoryId())
.orElseThrow(() -> {
log.warn("createMenu: 유효하지 않은 category id");
throw new CustomException(ErrorCode.CATEGORY_NOT_FOUND);
return new CustomException(ErrorCode.CATEGORY_NOT_FOUND);
});

Optional<Menu> existingMenu = menuRepository.findByCategoryAndMenuName(
Expand All @@ -59,6 +55,19 @@ public MenuResponse createMenu(MenuRequest request) {

}

@Transactional(readOnly = true)
public MenuResponse getMenuById(Long menuId) {

Menu menu = menuRepository.findById(menuId)
.orElseThrow(()->{
log.error("getMenuById : 유효하지않은 menuId");
return new CustomException(ErrorCode.MENU_NOT_FOUND);
});

return MenuResponse.from(menu);

}

@Transactional(readOnly = true)
public List<MenuResponse> getAllMenus() {

Expand All @@ -73,7 +82,7 @@ public List<MenuResponse> getAllMenusByCategory(Long categoryId) {
Category category = categoryRepository.findById(categoryId)
.orElseThrow(() -> {
log.warn("getAllMenusByCategory: 유효하지 않은 category id");
throw new CustomException(ErrorCode.CATEGORY_NOT_FOUND);
return new CustomException(ErrorCode.CATEGORY_NOT_FOUND);
});

List<Menu> menus = menuRepository.findByCategory(category);
Expand Down