Make application work with empty database

This commit is contained in:
Claudio Ortolina
2025-11-19 10:16:21 +00:00
parent d074bd5332
commit a597ff4032
6 changed files with 54 additions and 3 deletions
+11
View File
@@ -53,6 +53,17 @@ defmodule MusicLibrary.Collection do
Repo.all(q)
end
def get_latest_record do
q =
from r in Record,
where: not is_nil(r.purchased_at),
order_by: [{:desc, r.purchased_at}, order_alphabetically()],
limit: 1,
select: ^Records.essential_fields()
Repo.one(q)
end
def get_latest_record! do
q =
from r in Record,