Centralize pagination settings

This commit is contained in:
Claudio Ortolina
2026-02-17 08:24:07 +00:00
parent 0c4af8340b
commit 10b6a0703c
7 changed files with 36 additions and 17 deletions
+4 -2
View File
@@ -4,9 +4,11 @@ defmodule MusicLibrary.RecordSets do
alias MusicLibrary.RecordSets.{RecordSet, RecordSetItem}
alias MusicLibrary.Repo
@pagination Application.compile_env!(:music_library, :pagination)
def list_record_sets(opts \\ []) do
offset = Keyword.get(opts, :offset, 0)
limit = Keyword.get(opts, :limit, 20)
limit = Keyword.get(opts, :limit, @pagination[:default_page_size])
from(rs in RecordSet,
order_by: [desc: rs.updated_at],
@@ -28,7 +30,7 @@ defmodule MusicLibrary.RecordSets do
def search_record_sets(query, opts \\ []) do
offset = Keyword.get(opts, :offset, 0)
limit = Keyword.get(opts, :limit, 20)
limit = Keyword.get(opts, :limit, @pagination[:default_page_size])
order = Keyword.get(opts, :order, :updated_at)
record_sets_search_query(query)