-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore : QueryDsl 설정 추가 * feat : 엔티티 필드 수정 * feat : UserLog 정의 * feat : 컨텐츠 조회 영속성 계층 * feat : 컨텐츠 조회 어플리케이션 계층 * feat : 컨텐츠 조회 API * feat : 컨텐츠 조회 dto * chore : out-persistence 테스트용 yml 파일 * feat : UserLog 저장 방식 수정 * rename : yml local 프로파일
- Loading branch information
1 parent
3898214
commit d4c6d7c
Showing
23 changed files
with
431 additions
and
9 deletions.
There are no files selected for viewing
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
22 changes: 20 additions & 2 deletions
22
adapters/in-web/src/main/kotlin/com/pokit/content/dto/response/ContentResponse.kt
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 |
---|---|---|
@@ -1,19 +1,37 @@ | ||
package com.pokit.content.dto.response | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat | ||
import com.pokit.content.model.Content | ||
|
||
data class ContentResponse( | ||
val contentId: Long, | ||
val categoryId: Long, | ||
val data: String, | ||
val title: String, | ||
val memo: String, | ||
val alertYn: String | ||
val alertYn: String, | ||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:") | ||
val createdAt: String, | ||
val favorites: Boolean = false | ||
) | ||
|
||
fun Content.toResponse() = ContentResponse( | ||
contentId = this.id, | ||
categoryId = this.categoryId, | ||
data = this.data, | ||
title = this.title, | ||
memo = this.memo, | ||
alertYn = this.alertYn | ||
alertYn = this.alertYn, | ||
createdAt = this.createdAt.toString() | ||
) | ||
|
||
fun GetContentResponse.toResponse() = ContentResponse( | ||
contentId = this.contentId, | ||
categoryId = this.categoryId, | ||
data = this.data, | ||
title = this.title, | ||
memo = this.memo, | ||
alertYn = this.alertYn, | ||
createdAt = this.createdAt.toString(), | ||
favorites = this.favorites | ||
) |
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
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
16 changes: 16 additions & 0 deletions
16
adapters/out-persistence/src/main/kotlin/com/pokit/out/persistence/config/QueryDslConfig.kt
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,16 @@ | ||
package com.pokit.out.persistence.config | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory | ||
import jakarta.persistence.EntityManager | ||
import jakarta.persistence.PersistenceContext | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
class QueryDslConfig { | ||
@PersistenceContext | ||
lateinit var entityManager: EntityManager | ||
|
||
@Bean | ||
fun queryFactory() = JPAQueryFactory(entityManager) | ||
} |
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
16 changes: 16 additions & 0 deletions
16
adapters/out-persistence/src/main/kotlin/com/pokit/out/persistence/log/UserLogAdapter.kt
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,16 @@ | ||
package com.pokit.out.persistence.log | ||
|
||
import com.pokit.log.model.UserLog | ||
import com.pokit.log.port.out.UserLogPort | ||
import com.pokit.out.persistence.log.persist.UserLogEntity | ||
import com.pokit.out.persistence.log.persist.UserLogRepository | ||
import com.pokit.out.persistence.log.persist.toDomain | ||
import org.springframework.stereotype.Repository | ||
|
||
@Repository | ||
class UserLogAdapter( | ||
private val userLogRepository: UserLogRepository | ||
) : UserLogPort { | ||
override fun persist(userLog: UserLog) = | ||
userLogRepository.save(UserLogEntity.of(userLog)).toDomain() | ||
} |
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
7 changes: 7 additions & 0 deletions
7
...ut-persistence/src/main/kotlin/com/pokit/out/persistence/log/persist/UserLogRepository.kt
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,7 @@ | ||
package com.pokit.out.persistence.log.persist | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface UserLogRepository : JpaRepository<UserLogEntity, Long> { | ||
fun findByContentIdAndUserId(contentId: Long, userId: Long): UserLogEntity? | ||
} |
Oops, something went wrong.