-
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.
* fix: 오탈자 수정 * rename: 폴더 구조 변경 * feat: 즐겨찾기 리마인드 api * fix: 필요없는 코드 제거 * fix: domain 임시 모킹 * rename: 폴더구조 변경 * refactor: 주석제거 (#53) * feat: 페이징 처리 * feat: response 칼럼추가 * feat: response 칼럼 추가
- Loading branch information
Showing
27 changed files
with
215 additions
and
67 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
adapters/in-web/src/main/kotlin/com/pokit/content/RemindController.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,40 @@ | ||
package com.pokit.content | ||
|
||
import com.pokit.auth.model.PrincipalUser | ||
import com.pokit.common.dto.SliceResponseDto | ||
import com.pokit.common.wrapper.ResponseWrapper.wrapOk | ||
import com.pokit.common.wrapper.ResponseWrapper.wrapSlice | ||
import com.pokit.content.dto.response.RemindContentResponse | ||
import com.pokit.content.dto.response.toResponse | ||
import com.pokit.content.port.`in`.ContentUseCase | ||
import io.swagger.v3.oas.annotations.Operation | ||
import org.springframework.data.domain.Pageable | ||
import org.springframework.data.domain.Sort | ||
import org.springframework.data.web.PageableDefault | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/remind") | ||
class RemindController( | ||
private val contentUseCase: ContentUseCase | ||
) { | ||
@GetMapping("/bookmark") | ||
@Operation(summary = "즐겨찾기 링크 모음 조회 API") | ||
fun getBookmarkContents( | ||
@AuthenticationPrincipal user: PrincipalUser, | ||
@PageableDefault( | ||
page = 0, | ||
size = 10, | ||
sort = ["createdAt"], | ||
direction = Sort.Direction.DESC | ||
) pageable: Pageable, | ||
): ResponseEntity<SliceResponseDto<RemindContentResponse>> = | ||
contentUseCase.getBookmarkContents(user.id, pageable) | ||
.map { it.toResponse() } | ||
.wrapSlice() | ||
.wrapOk() | ||
} |
1 change: 0 additions & 1 deletion
1
adapters/in-web/src/main/kotlin/com/pokit/content/dto/request/CreateContentRequest.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
1 change: 0 additions & 1 deletion
1
adapters/in-web/src/main/kotlin/com/pokit/content/dto/request/UpdateContentRequest.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
30 changes: 30 additions & 0 deletions
30
adapters/in-web/src/main/kotlin/com/pokit/content/dto/response/RemindContentResponse.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,30 @@ | ||
package com.pokit.content.dto.response | ||
|
||
import com.pokit.category.model.RemindCategory | ||
import java.time.format.DateTimeFormatter | ||
|
||
data class RemindContentResponse( | ||
val contentId: Long, | ||
val category: RemindCategory, | ||
val title: String, | ||
val data: String, | ||
val createdAt: String, | ||
val domain: String, | ||
val isRead: Boolean, | ||
val thumbNail: String, | ||
) | ||
|
||
fun RemindContentResult.toResponse(): RemindContentResponse { | ||
val formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd") | ||
|
||
return RemindContentResponse( | ||
contentId = this.contentId, | ||
category = this.category, | ||
data = this.data, | ||
title = this.title, | ||
createdAt = this.createdAt.format(formatter), | ||
domain = this.domain, | ||
isRead = this.isRead, | ||
thumbNail = this.thumbNail | ||
) | ||
} |
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
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
2 changes: 2 additions & 0 deletions
2
...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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package com.pokit.out.persistence.log.persist | ||
|
||
import com.pokit.log.model.LogType | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface UserLogRepository : JpaRepository<UserLogEntity, Long> { | ||
fun findByContentIdAndUserId(contentId: Long, userId: Long): UserLogEntity? | ||
fun existsByContentIdAndUserIdAndType(contentId: Long, userId: Long, type: LogType): Boolean | ||
} |
2 changes: 1 addition & 1 deletion
2
adapters/out-persistence/src/testFixtures/kotlin/com/pokit/content/ContentFixture.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
6 changes: 6 additions & 0 deletions
6
application/src/main/kotlin/com/pokit/bookmark/port/out/BookmarkPort.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,11 +1,17 @@ | ||
package com.pokit.bookmark.port.out | ||
|
||
import com.pokit.bookmark.model.Bookmark | ||
import org.springframework.data.domain.Pageable | ||
import org.springframework.data.domain.Slice | ||
|
||
interface BookmarkPort { | ||
fun persist(bookmark: Bookmark): Bookmark | ||
|
||
fun delete(userId: Long, contentId: Long) | ||
|
||
fun loadByContentIdAndUserId(contentId: Long, userId: Long): Bookmark? | ||
|
||
fun loadByUserId(userId: Long, pageable: Pageable): Slice<Bookmark> | ||
|
||
fun isBookmarked(contentId: Long, userId: Long): Boolean | ||
} |
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
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
Oops, something went wrong.