use new query helper
All checks were successful
Build and Publish / build-release (push) Successful in 1m25s
All checks were successful
Build and Publish / build-release (push) Successful in 1m25s
This commit is contained in:
@@ -9,38 +9,17 @@ defmodule PolicyServiceWeb.PolicyController do
|
||||
alias PolicyService.Commands.CarPolicy
|
||||
|
||||
alias PolicyServiceWeb.Schemas.Policy, as: S
|
||||
alias PolicyServiceWeb.QueryHelpers
|
||||
|
||||
tags(["Policies"])
|
||||
security([%{"bearerAuth" => []}])
|
||||
|
||||
operation(:index,
|
||||
summary: "List policies",
|
||||
parameters: [
|
||||
"page[number]": [in: :query, type: :integer, required: false],
|
||||
"page[size]": [in: :query, type: :integer, required: false],
|
||||
filters: [
|
||||
in: :query,
|
||||
required: false,
|
||||
explode: true,
|
||||
description: """
|
||||
Apply filters in Flop format.
|
||||
|
||||
Example: filters[0][field]=status&filters[0][op]==&filters[0][value]=created
|
||||
""",
|
||||
schema: %{
|
||||
type: :array,
|
||||
items: %{
|
||||
type: :object,
|
||||
properties: %{
|
||||
field: %{type: :string, description: "Field to filter on"},
|
||||
op: %{type: :string, description: "Operator (e.g., ==, !=, ~>)"},
|
||||
value: %{type: :string, description: "Filter value"}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"order_by[]": [in: :query, type: :string, required: false]
|
||||
],
|
||||
parameters: QueryHelpers.flop(
|
||||
[:status, :policy_type, :search],
|
||||
[:submitted_at, :policy_type, :status]
|
||||
),
|
||||
responses: [
|
||||
ok: {"Policy list", "application/json", S.PolicyListResponse},
|
||||
bad_request: {"Invalid params", "application/json", S.ErrorResponse}
|
||||
|
||||
Reference in New Issue
Block a user