fix: use reverse sort for chats

This commit is contained in:
shadcn 2023-06-15 16:29:05 +04:00
parent a3c8f93de8
commit 2231c436cc

View file

@ -13,7 +13,9 @@ export async function getChats(userId?: string | null) {
try { try {
const pipeline = kv.pipeline() const pipeline = kv.pipeline()
const chats: string[] = await kv.zrange(`user:chat:${userId}`, 0, -1) const chats: string[] = await kv.zrange(`user:chat:${userId}`, 0, -1, {
rev: true
})
for (const chat of chats) { for (const chat of chats) {
pipeline.hgetall(chat) pipeline.hgetall(chat)