Skip to content

Commit

Permalink
Merge pull request #20 from MOKY4/feature/14
Browse files Browse the repository at this point in the history
feat: add content url column to hobby table
  • Loading branch information
CokeLee777 committed Jun 26, 2023
2 parents a8fd4d8 + 7c8c95c commit ec55756
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 44 deletions.
Binary file modified asset/images/HollangWeeks52_table_desc.xlsx
Binary file not shown.
3 changes: 2 additions & 1 deletion src/main/kotlin/swyg/hollang/InitDb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ class InitService(
val summary = row.getCell(2).stringCellValue
val description = row.getCell(3).stringCellValue
val imageName = row.getCell(4).stringCellValue
val contentUrl = row.getCell(5).stringCellValue
val imageUrl = "${IMG_URL}/hobby/$imageName.png"
val hobby = Hobby(originalName, shortName, summary, description, imageUrl)
val hobby = Hobby(originalName, shortName, summary, description, imageUrl, contentUrl)
em.persist(hobby)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ data class GetRecommendationResponse(
val summary: String = hobbyEntity.summary
val description: String = hobbyEntity.description
val imageUrl: String = hobbyEntity.imageUrl
val contentUrl: String = hobbyEntity.contentUrl
val ranking: Int = hobbyRanking
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/swyg/hollang/entity/Hobby.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class Hobby (
@Column(name = "img_url", nullable = false)
val imageUrl: String,

@Column(name = "content_url", nullable = false)
val contentUrl: String,

) : BaseTimeEntity() {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Binary file modified src/main/resources/static/initData.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class HobbyControllerTest(
"홀랑 $i 요약",
"홀랑 $i 상세정보",
"default",
"https://example.com/hollang$i.png"
"https://example.com/hollang$i.png",
"https://weeks52.me"
)
hobby.recommendCount = 40L - i
em.persist(hobby)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ internal class RecommendationControllerTest(
.andExpect(jsonPath("$.data.recommendation.hobbies[0].summary").exists())
.andExpect(jsonPath("$.data.recommendation.hobbies[0].description").exists())
.andExpect(jsonPath("$.data.recommendation.hobbies[0].imageUrl").exists())
.andExpect(jsonPath("$.data.recommendation.hobbies[0].contentUrl").exists())
.andExpect(jsonPath("$.data.recommendation.hobbies[0].ranking").exists())
.andExpect(jsonPath("$.data.recommendation.fitHobbyTypes.length()", 3).exists())
.andExpect(jsonPath("$.data.recommendation.fitHobbyTypes[0].id").exists())
Expand Down Expand Up @@ -234,9 +235,9 @@ internal class RecommendationControllerTest(
em.persist(hobbyType2)
em.persist(hobbyType3)

val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,12 @@ class TestResponseControllerTest(
)
em.persist(hobbyType)

val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ internal class RecommendationManagerTest(
em.persist(hobbyType2)
em.persist(hobbyType3)

val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ internal class TestResponseManagerTest(
)
em.persist(hobbyType)

val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기", "스토리텔링", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기", "어도비 인디자인", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("Adobe illustrator로 나만의 굿즈 만들기", "어도비 일러스트레이트",
"취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("사람들을 사로잡는 스토리텔링 시작하기",
"스토리텔링", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("Adobe InDesign으로 편집 디자인 시작하기",
"어도비 인디자인", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ internal class HobbyRepositoryTest(@Autowired val hobbyRepository: HobbyReposito
@DisplayName("취미 이름들로 취미들 조회")
fun findByNameIsIn() {
// given
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobbyRepository.save(hobby1)
hobbyRepository.save(hobby2)
hobbyRepository.save(hobby3)
Expand All @@ -41,11 +44,14 @@ internal class HobbyRepositoryTest(@Autowired val hobbyRepository: HobbyReposito
@DisplayName("모든 취미들을 정렬하여 조회")
fun findAll() {
// given
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobby1.recommendCount = 3
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobby2.recommendCount = 2
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobby3.recommendCount = 1
hobbyRepository.save(hobby1)
hobbyRepository.save(hobby2)
Expand All @@ -64,11 +70,14 @@ internal class HobbyRepositoryTest(@Autowired val hobbyRepository: HobbyReposito
@DisplayName("취미 이름들로 취미들의 추천수를 1씩 증가")
fun incrementRecommendCountByNameIsIn() {
// given
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobby1.recommendCount = 3
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobby2.recommendCount = 2
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
hobby3.recommendCount = 1
hobbyRepository.save(hobby1)
hobbyRepository.save(hobby2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ internal class RecommendationRepositoryTest(
)
em.persist(hobbyType)

val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ internal class TestResponseRepositoryTest(
)
em.persist(hobbyType)

val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보",
"https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
18 changes: 9 additions & 9 deletions src/test/kotlin/swyg/hollang/service/hobby/HobbyServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ internal class HobbyServiceTest(
// given
val validNames = listOf("취미1", "취미2", "취미3")
val invalidNames = listOf("취미4", "취미5", "취미6")
val hobby1 = Hobby(validNames[0], "취미1 요약","취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby(validNames[1], "취미2 요약","취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby(validNames[2], "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby(validNames[0], "취미1 요약","취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby(validNames[1], "취미2 요약","취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby(validNames[2], "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand All @@ -50,9 +50,9 @@ internal class HobbyServiceTest(
// given
val validNames = listOf("취미1", "취미2", "취미3")
val invalidNames = listOf("취미4", "취미5", "취미6")
val hobby1 = Hobby(validNames[0], "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby(validNames[1], "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby(validNames[2], "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby(validNames[0], "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby(validNames[1], "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby(validNames[2], "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand All @@ -72,10 +72,10 @@ internal class HobbyServiceTest(
fun getAll() {
// given
val names = listOf("취미1", "취미2", "취미3")
val hobby1 = Hobby(names[0], "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby(names[0], "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
hobby1.recommendCount = 3
val hobby2 = Hobby(names[1], "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby(names[2], "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby(names[1], "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby(names[2], "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ internal class RecommendationServiceTest(
)
em.persist(hobbyType)

val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ internal class TestResponseServiceTest(
)
em.persist(hobbyType)

val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com")
val hobby1 = Hobby("취미1", "취미1 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby2 = Hobby("취미2", "취미2 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
val hobby3 = Hobby("취미3", "취미3 요약", "취미 요약정보", "취미 상세정보", "https://example.com", "https://weeks52.me")
em.persist(hobby1)
em.persist(hobby2)
em.persist(hobby3)
Expand Down

0 comments on commit ec55756

Please sign in to comment.