enzostvs HF staff commited on
Commit
0d2d95b
β€’
1 Parent(s): a1d7896

gallery filter by most liked

Browse files
src/routes/api/community/+server.ts CHANGED
@@ -18,7 +18,11 @@ export async function GET(request : RequestEvent) {
18
  orderBy: {
19
  ...(filter === 'new' ? {
20
  createdAt: 'desc'
21
- } : {}
 
 
 
 
22
  )
23
  },
24
  select: {
 
18
  orderBy: {
19
  ...(filter === 'new' ? {
20
  createdAt: 'desc'
21
+ } : {
22
+ reactions: {
23
+ _count: 'desc'
24
+ }
25
+ }
26
  )
27
  },
28
  select: {
src/routes/gallery/+page.ts CHANGED
@@ -1,5 +1,5 @@
1
  export async function load({ fetch }) {
2
- const response = await fetch("/api/community?page=0&filter=hotest", {
3
  method: "GET",
4
  headers: {
5
  "Content-Type": "application/json"
 
1
  export async function load({ fetch }) {
2
+ const response = await fetch("/api/community?page=0&filter=new", {
3
  method: "GET",
4
  headers: {
5
  "Content-Type": "application/json"