mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
On the domain side this PR extends `Domain.Repo` with filtering, pagination, and ordering, along with some convention changes are removing the code that is not needed since we have the filtering now. This required to touch pretty much all contexts and code, but I went through all public functions and added missing tests to make sure nothing will be broken. On the web side I've introduced a `<.live_table />` which is as close as possible to being a drop-in replacement for the regular `<.table />` (but requires to structure the LiveView module differently due to assigns anyways). I've updated all the listing tables to use it.
42 lines
738 B
Elixir
42 lines
738 B
Elixir
defmodule API do
|
|
def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)
|
|
|
|
def router do
|
|
quote do
|
|
use Phoenix.Router, helpers: false
|
|
import Plug.Conn
|
|
import Phoenix.Controller
|
|
end
|
|
end
|
|
|
|
def channel do
|
|
quote do
|
|
use Phoenix.Channel
|
|
end
|
|
end
|
|
|
|
def controller do
|
|
quote do
|
|
use Phoenix.Controller,
|
|
formats: [:json]
|
|
|
|
import Plug.Conn
|
|
|
|
unquote(verified_routes())
|
|
end
|
|
end
|
|
|
|
def verified_routes do
|
|
quote do
|
|
use Phoenix.VerifiedRoutes,
|
|
endpoint: API.Endpoint,
|
|
router: API.Router,
|
|
statics: API.static_paths()
|
|
end
|
|
end
|
|
|
|
defmacro __using__(which) when is_atom(which) do
|
|
apply(__MODULE__, which, [])
|
|
end
|
|
end
|