Version endpoints

This commit is contained in:
Shadowfacts 2024-04-07 12:08:17 -04:00
parent f498f8672c
commit 56b93d42e5
2 changed files with 8 additions and 4 deletions

View File

@ -21,7 +21,7 @@ defmodule TuskerPushWeb.RegistrationsController do
conn
|> json(%{
id: id,
endpoint: url(~p"/mastodon/push/#{id}")
endpoint: url(~p"/mastodon/v1/push/#{id}")
})
else
{:error, %Changeset{valid?: false} = changeset} ->
@ -64,7 +64,7 @@ defmodule TuskerPushWeb.RegistrationsController do
{:registration, TuskerPush.get_registration(id)},
{:ok, _} <- TuskerPush.update_registration(registration, params) do
conn
|> json(%{id: id, endpoint: url(~p"/mastodon/push/#{id}")})
|> json(%{id: id, endpoint: url(~p"/mastodon/v1/push/#{id}")})
else
{:registration, nil} ->
conn

View File

@ -8,12 +8,16 @@ defmodule TuskerPushWeb.Router do
scope "/app", TuskerPushWeb do
pipe_through :api
resources "/registrations", RegistrationsController, only: [:create, :update, :delete]
scope "/v1" do
resources "/registrations", RegistrationsController, only: [:create, :update, :delete]
end
end
scope "/mastodon", TuskerPushWeb do
pipe_through :api
post "/push/:id", PushController, :push
scope "/v1" do
post "/push/:id", PushController, :push
end
end
end