Skip to content

Commit c512ba7

Browse files
committed
feat(api): enhance streamer suggestion endpoint with additional sorting by name
1 parent 1c82ce2 commit c512ba7

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

apps/backend/src/api/index.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { zValidator } from '@hono/zod-validator';
2-
import { and, desc, eq, ilike, isNotNull, or, type SQL } from 'drizzle-orm';
2+
import {
3+
and,
4+
asc,
5+
desc,
6+
eq,
7+
ilike,
8+
isNotNull,
9+
or,
10+
type SQL,
11+
} from 'drizzle-orm';
312
import { Hono } from 'hono';
413
import { z } from 'zod';
514
import cache from '@/lib/cache/default';
@@ -68,7 +77,11 @@ const api = new Hono<ApiContext>()
6877
title: true,
6978
},
7079
where: and(...conditions),
71-
orderBy: [desc(streamer.isLive), desc(streamer.viewerCount)],
80+
orderBy: [
81+
desc(streamer.isLive),
82+
desc(streamer.viewerCount),
83+
asc(streamer.name),
84+
],
7285
});
7386

7487
await cache.set(cacheKey, JSON.stringify(streamers));

0 commit comments

Comments
 (0)