From d98c2193989c30771f2f1551480a6bbfb6594524 Mon Sep 17 00:00:00 2001 From: HaimKortovich Date: Wed, 15 Apr 2026 13:36:00 -0500 Subject: [PATCH] add route and compose rabbit url --- .../controllers/policy_controller.ex | 52 ------------------- lib/policy_service_web/router.ex | 1 - ops/chart/values.yaml | 19 +++++++ 3 files changed, 19 insertions(+), 53 deletions(-) diff --git a/lib/policy_service_web/controllers/policy_controller.ex b/lib/policy_service_web/controllers/policy_controller.ex index 425a703..6622835 100644 --- a/lib/policy_service_web/controllers/policy_controller.ex +++ b/lib/policy_service_web/controllers/policy_controller.ex @@ -181,54 +181,6 @@ defmodule PolicyServiceWeb.PolicyController do end end - # --------------------------------------------------------------------------- - # GET /api/policies/:application_id/solicitation-url - # --------------------------------------------------------------------------- - - operation(:solicitation_url, - summary: "Get fresh presigned download URL for solicitation PDF", - parameters: [ - application_id: [in: :path, type: :string, required: true], - version: [in: :query, type: :integer, required: false] - ], - responses: [ - ok: {"Presigned URL", "application/json", S.SolicitationUrlResponse}, - not_found: {"Not found", "application/json", S.ErrorResponse} - ] - ) - - def solicitation_url(conn, %{"application_id" => application_id} = params) do - org_id = conn.assigns[:org_id] || "test" - version = String.to_integer(params["version"] || "1") - - case PolicyQueries.get_by_application_id(org_id, application_id) do - {:error, :not_found} -> - conn |> put_status(:not_found) |> json(%{error: "policy not found"}) - - {:ok, %{solicitation_id: nil}} -> - conn |> put_status(:not_found) |> json(%{error: "no solicitation yet"}) - - {:ok, policy} -> - url = - "#{solicitation_service_url()}/api/solicitations/#{policy.solicitation_id}/download-url" - - case Req.get(url, - params: [org_id: org_id, application_id: application_id, version: version] - ) do - {:ok, %{status: 200, body: body}} -> - conn |> put_status(:ok) |> json(body) - - {:ok, %{status: status, body: body}} -> - conn - |> put_status(:bad_gateway) - |> json(%{error: "solicitation service returned #{status}: #{inspect(body)}"}) - - {:error, reason} -> - conn |> put_status(:bad_gateway) |> json(%{error: inspect(reason)}) - end - end - end - # --------------------------------------------------------------------------- # Serializers # --------------------------------------------------------------------------- @@ -371,8 +323,4 @@ defmodule PolicyServiceWeb.PolicyController do end defp parse_providers(_), do: {:error, :invalid_providers} - - defp solicitation_service_url do - Application.get_env(:policy_service, :solicitation_service_url, "http://localhost:8081") - end end diff --git a/lib/policy_service_web/router.ex b/lib/policy_service_web/router.ex index ac3b89e..c0d3ed3 100644 --- a/lib/policy_service_web/router.ex +++ b/lib/policy_service_web/router.ex @@ -21,7 +21,6 @@ defmodule PolicyServiceWeb.Router do get "/policies/:application_id", PolicyController, :show post "/policies", PolicyController, :create post "/policies/:application_id/accept", PolicyController, :accept - get "/policies/:application_id/solicitation-url", PolicyController, :solicitation_url end end diff --git a/ops/chart/values.yaml b/ops/chart/values.yaml index d9deace..18815de 100644 --- a/ops/chart/values.yaml +++ b/ops/chart/values.yaml @@ -87,6 +87,25 @@ service: protocol: HTTP +route: + main: + parentRefs: + - name: workload-dev-external-gateway + group: gateway.networking.k8s.io + kind: Gateway + sectionName: https-api + hostnames: + - dev.api.corredorconect.com + rules: + - matches: + - path: + type: PathPrefix + value: /policy + backendRefs: + - name: '{{ include "bjw-s.common.lib.chart.names.fullname" $ }}' + port: 8080 + + rawResources: rabbitmq-user: enabled: true