Browse Source

feat: show most viewed notes

main
Inhji Y. 8 months ago
parent
commit
82597f3cd4
  1. 11
      lib/mirage/notes.ex

11
lib/mirage/notes.ex

@ -77,6 +77,17 @@ defmodule Mirage.Notes do
Repo.all(q)
end
def list_notes(:most_viewed) do
q =
from n in Note,
limit: 3,
select: n,
order_by: [desc: n.views],
preload: ^@note_preloads
Repo.all(q)
end
def list_notes(:unlinked) do
q =
from n in Note,

Loading…
Cancel
Save