From 87175eb8eab87fe27ef7d7663d71e82a92854a2d Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Thu, 15 Apr 2021 02:53:32 +0200 Subject: [PATCH] clean route comment --- .../comment/generic/database/CommentRepository.kt | 2 +- .../component/comment/generic/routes/GetCommentChildren.kt | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/fr/dcproject/component/comment/generic/database/CommentRepository.kt b/src/main/kotlin/fr/dcproject/component/comment/generic/database/CommentRepository.kt index b5fdf8a..8a86a7b 100644 --- a/src/main/kotlin/fr/dcproject/component/comment/generic/database/CommentRepository.kt +++ b/src/main/kotlin/fr/dcproject/component/comment/generic/database/CommentRepository.kt @@ -21,7 +21,7 @@ abstract class CommentRepositoryAbs(override var requester: Request ): Paginated> open fun findByParent( - parent: CommentForView, + parent: CommentI, page: Int = 1, limit: Int = 50 ): Paginated> { diff --git a/src/main/kotlin/fr/dcproject/component/comment/generic/routes/GetCommentChildren.kt b/src/main/kotlin/fr/dcproject/component/comment/generic/routes/GetCommentChildren.kt index 52d1c1e..a478f0d 100644 --- a/src/main/kotlin/fr/dcproject/component/comment/generic/routes/GetCommentChildren.kt +++ b/src/main/kotlin/fr/dcproject/component/comment/generic/routes/GetCommentChildren.kt @@ -4,6 +4,7 @@ import fr.dcproject.common.response.toOutput import fr.dcproject.common.security.assert import fr.dcproject.component.auth.citizenOrNull import fr.dcproject.component.comment.generic.CommentAccessControl +import fr.dcproject.component.comment.generic.database.CommentRef import fr.dcproject.component.comment.generic.database.CommentRepository import fr.dcproject.component.comment.toOutput import fr.dcproject.routes.PaginatedRequest @@ -21,11 +22,13 @@ import java.util.UUID object GetCommentChildren { @Location("/comments/{comment}/children") class CommentChildrenRequest( - val comment: UUID, + comment: UUID, page: Int = 1, limit: Int = 50, val search: String? = null - ) : PaginatedRequestI by PaginatedRequest(page, limit) + ) : PaginatedRequestI by PaginatedRequest(page, limit) { + val comment = CommentRef(comment) + } fun Route.getChildrenComments(repo: CommentRepository, ac: CommentAccessControl) { get {