Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements an admin API for updating spot status in the system. The implementation includes validation logic to ensure spots have required fields before being activated and prevents duplicate active spots with the same name and address.
- Added service layer method with business logic validation for spot status changes
- Created request DTO with validation annotations for API input
- Updated controller endpoint to use proper request object instead of generic Map
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Spot.java | Added domain method to update spot status |
| AdminService.java | Implemented business logic for spot status updates with validation |
| UpdateSpotStatusRequest.java | Created request DTO with validation for status updates |
| AdminController.java | Updated endpoint to use proper request object and validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @Transactional | ||
| public void updateSpotStatus(final Long spotId, final UpdateSpotStatusRequest request) { | ||
| // 1. Spot 존재 확인 | ||
| SpotEntity spotEntity = spotRepository.findByIdOrElseThrow(spotId); | ||
| Spot spot = spotMapper.toDomain(spotEntity); | ||
|
|
||
| // 2. ACTIVE로 변경하려는 경우 추가 검증 | ||
| if (request.targetStatus() == SpotStatus.ACTIVE) { |
There was a problem hiding this comment.
Use .equals() instead of == when comparing enum values to follow Java best practices and avoid potential issues with enum comparison.
| } | ||
|
|
||
| // 3. Restaurant인 경우 spotFeatureList와 priceFeature 필수 | ||
| if (spotType == SpotType.RESTAURANT) { |
There was a problem hiding this comment.
Use .equals() instead of == when comparing enum values to follow Java best practices and avoid potential issues with enum comparison.
| if (spotType == SpotType.RESTAURANT) { | |
| if (spotType.equals(SpotType.RESTAURANT)) { |
💡 Issue
📄 Description