Version endpoints
This commit is contained in:
parent
f498f8672c
commit
56b93d42e5
|
@ -21,7 +21,7 @@ defmodule TuskerPushWeb.RegistrationsController do
|
||||||
conn
|
conn
|
||||||
|> json(%{
|
|> json(%{
|
||||||
id: id,
|
id: id,
|
||||||
endpoint: url(~p"/mastodon/push/#{id}")
|
endpoint: url(~p"/mastodon/v1/push/#{id}")
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
{:error, %Changeset{valid?: false} = changeset} ->
|
{:error, %Changeset{valid?: false} = changeset} ->
|
||||||
|
@ -64,7 +64,7 @@ defmodule TuskerPushWeb.RegistrationsController do
|
||||||
{:registration, TuskerPush.get_registration(id)},
|
{:registration, TuskerPush.get_registration(id)},
|
||||||
{:ok, _} <- TuskerPush.update_registration(registration, params) do
|
{:ok, _} <- TuskerPush.update_registration(registration, params) do
|
||||||
conn
|
conn
|
||||||
|> json(%{id: id, endpoint: url(~p"/mastodon/push/#{id}")})
|
|> json(%{id: id, endpoint: url(~p"/mastodon/v1/push/#{id}")})
|
||||||
else
|
else
|
||||||
{:registration, nil} ->
|
{:registration, nil} ->
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -8,12 +8,16 @@ defmodule TuskerPushWeb.Router do
|
||||||
scope "/app", TuskerPushWeb do
|
scope "/app", TuskerPushWeb do
|
||||||
pipe_through :api
|
pipe_through :api
|
||||||
|
|
||||||
resources "/registrations", RegistrationsController, only: [:create, :update, :delete]
|
scope "/v1" do
|
||||||
|
resources "/registrations", RegistrationsController, only: [:create, :update, :delete]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/mastodon", TuskerPushWeb do
|
scope "/mastodon", TuskerPushWeb do
|
||||||
pipe_through :api
|
pipe_through :api
|
||||||
|
|
||||||
post "/push/:id", PushController, :push
|
scope "/v1" do
|
||||||
|
post "/push/:id", PushController, :push
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue