use reverse layout

This commit is contained in:
2026-08-07 21:52:22 +03:00
parent e210e773e9
commit 7aa84674f5
5 changed files with 8 additions and 6 deletions
@@ -23,7 +23,7 @@ class SqlMessageStorage(
queries.getInitialChatContext(
chatId = chatId,
limit = limit.toLong()
).executeAsList().reversed().map { it.toMessage() }
).executeAsList().map { it.toMessage() }
} else {
queries.getNewMessages(
chatId = chatId,
@@ -25,7 +25,8 @@ fun Route.setupChat(
get("$DYNAMIC_PREFIX/chat/query") {
val repository = chatRepositoryFactory.create(call.obtainUserId())
val afterId = call.queryParameters[ChatRepository.ARG_AFTER_ID]?.toLong()
call.respond(MessagesResponse(repository.query(afterId)))
val list = repository.query(afterId)
call.respond(MessagesResponse(list))
}
post("$DYNAMIC_PREFIX/chat/send") {
val userId = call.obtainUserId()
@@ -30,7 +30,7 @@ class RemoteChatRepository(
"${DYNAMIC_PREFIX}/chat/query",
args,
serverConfigurationRepository.getServerConfiguration()
).content
).content.asReversed()
}
override suspend fun send(message: Message) {