Support assets upserts

This commit is contained in:
Claudio Ortolina
2025-09-01 15:06:00 +03:00
parent bd12454884
commit cbf567a502
2 changed files with 7 additions and 9 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ defmodule MusicLibrary.Assets do
def store(params) do
%Asset{}
|> Asset.changeset(params)
|> Repo.insert()
|> Repo.insert(on_conflict: :nothing, returning: true)
end
@doc """
@@ -18,7 +18,7 @@ defmodule MusicLibrary.Assets do
def store_image(params) do
%Asset{}
|> Asset.image_changeset(params)
|> Repo.insert()
|> Repo.insert(on_conflict: :nothing, returning: true)
end
def get(hash) do