-
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: resolve merge conlficts from dev branch
- Loading branch information
Showing
37 changed files
with
549 additions
and
58 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/com/dobby/backend/application/mapper/MemberMapper.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,13 @@ | ||
package com.dobby.backend.application.mapper | ||
|
||
import com.dobby.backend.application.usecase.member.GetMyExperimentPostsUseCase | ||
import com.dobby.backend.domain.model.experiment.Pagination | ||
|
||
object MemberMapper { | ||
fun toDomainPagination(pagination: GetMyExperimentPostsUseCase.PaginationInput): Pagination { | ||
return Pagination( | ||
page = pagination.page, | ||
count = pagination.count | ||
) | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/dobby/backend/application/service/PaginationService.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,11 @@ | ||
package com.dobby.backend.application.service | ||
|
||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class PaginationService { | ||
|
||
fun isLastPage(totalElements: Int, pageSize: Int, currentPage: Int): Boolean { | ||
return totalElements <= pageSize * currentPage | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
...tlin/com/dobby/backend/application/usecase/member/GetMyExperimentPostTotalCountUseCase.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,22 @@ | ||
package com.dobby.backend.application.usecase.member | ||
|
||
import com.dobby.backend.application.usecase.UseCase | ||
import com.dobby.backend.domain.gateway.experiment.ExperimentPostGateway | ||
|
||
class GetMyExperimentPostTotalCountUseCase( | ||
private val experimentPostGateway: ExperimentPostGateway | ||
): UseCase<GetMyExperimentPostTotalCountUseCase.Input, GetMyExperimentPostTotalCountUseCase.Output> { | ||
|
||
data class Input( | ||
val memberId: Long | ||
) | ||
|
||
data class Output( | ||
val totalPostCount: Int | ||
) | ||
|
||
override fun execute(input: Input): Output { | ||
val totalPostCount = experimentPostGateway.countExperimentPostsByMemberId(input.memberId) | ||
return Output(totalPostCount = totalPostCount) | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/kotlin/com/dobby/backend/application/usecase/member/GetMyExperimentPostsUseCase.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,50 @@ | ||
package com.dobby.backend.application.usecase.member | ||
|
||
import com.dobby.backend.application.mapper.MemberMapper | ||
import com.dobby.backend.application.usecase.UseCase | ||
import com.dobby.backend.domain.gateway.experiment.ExperimentPostGateway | ||
import java.time.LocalDate | ||
|
||
class GetMyExperimentPostsUseCase( | ||
private val experimentPostGateway: ExperimentPostGateway | ||
): UseCase<GetMyExperimentPostsUseCase.Input, List<GetMyExperimentPostsUseCase.Output>> { | ||
|
||
data class Input( | ||
val memberId: Long, | ||
val pagination: PaginationInput | ||
) | ||
|
||
data class PaginationInput( | ||
val page: Int = 1, | ||
val count: Int = 6, | ||
val order: String = "DESC" | ||
) | ||
|
||
data class Output( | ||
val experimentPostId: Long, | ||
val title: String, | ||
val content: String, | ||
val views: Int, | ||
val recruitDone: Boolean, | ||
val uploadDate: LocalDate | ||
) | ||
|
||
override fun execute(input: Input): List<Output> { | ||
val posts = experimentPostGateway.findExperimentPostsByMemberIdWithPagination( | ||
memberId = input.memberId, | ||
pagination = MemberMapper.toDomainPagination(input.pagination), | ||
order = input.pagination.order | ||
) | ||
|
||
return posts?.map { post -> | ||
Output( | ||
experimentPostId = post.id, | ||
title = post.title, | ||
content = post.content, | ||
views = post.views, | ||
recruitDone = post.recruitDone, | ||
uploadDate = post.createdAt.toLocalDate() | ||
) | ||
} ?: emptyList() | ||
} | ||
} |
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
Oops, something went wrong.