-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from LIKELION-TEAM4-HACKATHON/feature/get-regi…
…on-category feat: 지역 카테고리 조회 기능 구현
- Loading branch information
Showing
8 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/likelion/MZConnent/dto/club/RegionCategoryDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package likelion.MZConnent.dto.club; | ||
|
||
import likelion.MZConnent.domain.club.RegionCategory; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class RegionCategoryDto { | ||
private Long regionCategoryId; | ||
private String name; | ||
|
||
public RegionCategoryDto(RegionCategory regionCategory) { | ||
this.regionCategoryId = regionCategory.getRegionId(); | ||
this.name = regionCategory.getName(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/likelion/MZConnent/dto/club/response/RegionCategoryResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package likelion.MZConnent.dto.club.response; | ||
|
||
import likelion.MZConnent.domain.club.RegionCategory; | ||
import likelion.MZConnent.dto.club.RegionCategoryDto; | ||
import likelion.MZConnent.dto.culture.CultureCategoryDto; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class RegionCategoryResponse { | ||
List<RegionCategoryDto> regionCategories = new ArrayList<>(); | ||
|
||
public RegionCategoryResponse(List<RegionCategory> regionCategory) { | ||
this.regionCategories = regionCategory.stream() | ||
.map(RegionCategoryDto::new) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/likelion/MZConnent/service/club/RegionCategoryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package likelion.MZConnent.service.club; | ||
|
||
import likelion.MZConnent.domain.club.RegionCategory; | ||
import likelion.MZConnent.dto.club.RegionCategoryDto; | ||
import likelion.MZConnent.dto.club.response.RegionCategoryResponse; | ||
import likelion.MZConnent.repository.club.RegionCategoryRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class RegionCategoryService { | ||
private final RegionCategoryRepository regionCategoryRepository; | ||
|
||
public RegionCategoryResponse getAllRegionCategories() { | ||
List<RegionCategory> regionCategories = regionCategoryRepository.findAll(); | ||
|
||
return new RegionCategoryResponse(regionCategories); | ||
} | ||
} |