Files
pinchflat/lib/pinchflat_web/controllers/api/v1/api_task_controller.ex
T
hermes-agent 5647e5642a
Build, Lint, and Test / Build, Lint, and Test (push) Failing after 1m21s
Fix CI: remove unused aliases, run mix format, install root yarn deps
- Remove unused aliases that caused warnings-as-errors in EX_CHECK mode
- Run mix format to fix formatter check
- Add root-level yarn install to CI for prettier (used by mix check)
- All 1007 tests pass, zero warnings
2026-07-04 09:48:47 +00:00

35 lines
732 B
Elixir

defmodule PinchflatWeb.Api.V1.ApiTaskController do
@moduledoc """
JSON API controller for Tasks.
"""
use PinchflatWeb, :controller
action_fallback PinchflatWeb.Api.V1.FallbackController
alias Pinchflat.Repo
alias Pinchflat.Tasks
def index(conn, params) do
tasks =
case params do
%{"source_id" => source_id} ->
source = Pinchflat.Sources.get_source!(source_id)
Tasks.list_tasks_for(source)
|> Repo.preload(:job)
_ ->
Tasks.list_tasks()
|> Repo.preload(:job)
end
json(conn, %{data: tasks})
end
def show(conn, %{"id" => id}) do
task = Tasks.get_task!(id) |> Repo.preload(:job)
json(conn, %{data: task})
end
end