fix: flatten nested case blocks with with chains (CSM-020)

Replace deeply nested case expressions with flat with chains in
import_definitions, publishing, and templates modules. Also replaced
Repo.update!() with Repo.update() in the publishing update_job handler.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 12:36:42 +02:00
parent b6f9cf58e1
commit 7c00279b9d
5 changed files with 171 additions and 100 deletions

View File

@@ -47,18 +47,12 @@ defmodule BDS.Publishing do
end
def handle_call({:update_job, job_id, attrs}, _from, state) do
reply =
case Repo.get(PublishJob, job_id) do
nil ->
:ok
with %PublishJob{} = job <- Repo.get(PublishJob, job_id) do
attrs = Map.put(attrs, :updated_at, Persistence.now_ms())
job |> PublishJob.changeset(attrs) |> Repo.update()
end
job ->
attrs = Map.put(attrs, :updated_at, Persistence.now_ms())
job |> PublishJob.changeset(attrs) |> Repo.update!()
:ok
end
{:reply, reply, state}
{:reply, :ok, state}
end
def handle_call({:should_upload_scp_file, upload_key, local_mtime}, _from, state) do