Skip to content

Commit bd3840c

Browse files
committed
feat(social): adds db order-by on new queries
1 parent a0bf016 commit bd3840c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/codes/clj/docs/backend/db/postgres.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296

297297
(defn get-top-authors
298298
{:malli/schema [:=> [:cat :int schemas.types/DatabaseComponent]
299-
[:maybe [:sequential schemas.model.social/Author+Interactions]]]} ; todo out schema
299+
[:maybe [:sequential schemas.model.social/Author+Interactions]]]}
300300
[limit db]
301301
(->> (-> (sql.helpers/select
302302
:author/*
@@ -317,6 +317,7 @@
317317
(sql.helpers/join :author
318318
[:= :social/author-id :author/author-id])
319319
(sql.helpers/group-by :author/author-id)
320+
(sql.helpers/order-by [:interactions :desc])
320321
(sql.helpers/limit limit)
321322
sql/format)
322323
(execute! db)
@@ -330,7 +331,7 @@
330331
get-note-query
331332
get-example-query
332333
get-see-also-query)
333-
(sql.helpers/order-by :created)
334+
(sql.helpers/order-by [:created :desc])
334335
(sql.helpers/limit limit)
335336
sql/format)
336337
(execute! db)

0 commit comments

Comments
 (0)