diff --git a/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt b/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt index b76a86e56..73049fd2d 100644 --- a/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt +++ b/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt @@ -139,7 +139,7 @@ open class ChannelService( ChannelQuery.GetMessagesFromChannelId.Response( channel.messages.subList( request.from, - request.to.coerceAtMost(channel.messages.size) + request.limit.coerceAtMost(channel.messages.size) ) ) ) diff --git a/servers-service/src/main/kotlin/piperkt/services/servers/application/api/query/ChannelQuery.kt b/servers-service/src/main/kotlin/piperkt/services/servers/application/api/query/ChannelQuery.kt index e22c0ef96..1cfdb38c6 100644 --- a/servers-service/src/main/kotlin/piperkt/services/servers/application/api/query/ChannelQuery.kt +++ b/servers-service/src/main/kotlin/piperkt/services/servers/application/api/query/ChannelQuery.kt @@ -12,7 +12,7 @@ sealed interface ChannelQuery { val serverId: ServerId, val channelId: ChannelId, val from: Int, - val to: Int, + val limit: Int, override val requestFrom: String, ) : GetMessagesFromChannelId, ServiceRequest diff --git a/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/ChannelHttpController.kt b/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/ChannelHttpController.kt index bd739d84a..8b838d3ce 100644 --- a/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/ChannelHttpController.kt +++ b/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/ChannelHttpController.kt @@ -107,7 +107,7 @@ class ChannelHttpController(private val channelService: ChannelService) : Channe serverId: String, channelId: String, from: Int, - to: Int, + limit: Int, principal: Principal, ): ChannelApi.GetChannelMessagesApi.Response { val response = @@ -118,7 +118,7 @@ class ChannelHttpController(private val channelService: ChannelService) : Channe channelId = ChannelId(channelId), serverId = ServerId(serverId), from = from, - to = to + limit = limit ) ) .getOrThrow() diff --git a/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/api/ChannelHttpControllerApi.kt b/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/api/ChannelHttpControllerApi.kt index 4b84bdfe1..69a93e573 100644 --- a/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/api/ChannelHttpControllerApi.kt +++ b/servers-service/src/main/kotlin/piperkt/services/servers/interfaces/web/api/ChannelHttpControllerApi.kt @@ -76,7 +76,7 @@ interface ChannelHttpControllerApi { @PathVariable serverId: String, @PathVariable channelId: String, @QueryValue from: Int, - @QueryValue to: Int, + @QueryValue limit: Int, principal: Principal ): ChannelApi.GetChannelMessagesApi.Response diff --git a/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpClient.kt b/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpClient.kt index cc380fcca..b4908d722 100644 --- a/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpClient.kt +++ b/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpClient.kt @@ -57,7 +57,7 @@ interface ChannelHttpClient { @PathVariable serverId: String, @PathVariable channelId: String, @QueryValue from: Int, - @QueryValue to: Int, + @QueryValue limit: Int, @Header(HttpHeaders.AUTHORIZATION) authorization: String = authOf("user") ): HttpResponse diff --git a/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpControllerTest.kt b/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpControllerTest.kt index 775095c1c..02d446617 100644 --- a/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpControllerTest.kt +++ b/servers-service/src/test/kotlin/piperkt/services/servers/interfaces/web/channel/ChannelHttpControllerTest.kt @@ -169,7 +169,7 @@ class ChannelHttpControllerTest(private var client: ChannelHttpClient) : Integra serverId = basicServerId, channelId = it, from = 0, - to = 10 + limit = 10 ) } response.status() shouldBe HttpStatus.OK @@ -182,7 +182,7 @@ class ChannelHttpControllerTest(private var client: ChannelHttpClient) : Integra serverId = basicServerId, channelId = "channelId", from = 0, - to = 10 + limit = 10 ) response.status() shouldBe HttpStatus.NOT_FOUND } @@ -195,7 +195,7 @@ class ChannelHttpControllerTest(private var client: ChannelHttpClient) : Integra serverId = basicServerId, channelId = channelId, from = 0, - to = 10, + limit = 10, authorization = authOf("anotherUser") ) }