radiator icon indicating copy to clipboard operation
radiator copied to clipboard

GraphQL API: provide api to check avialability of ShortID

Open monkeydom opened this issue 6 years ago • 1 comments

With the current publishing the shortID is also the slug in the root of the server. Because we think this is nice, we should also provide an api to test the availablity of shortIDs beforehand.

monkeydom avatar Sep 25 '19 10:09 monkeydom

As I understand it is that you actually want to check the availability of the slug because that is used in the URL (and the short id is technically always available because it's non unique). But there is the connection to the short id because the short id is converted to the slug. It's a bit confusing. And it gets complicated because the slug has to be unique but the short id can be non unique.

It's tied together through this piece of code:

  # for Podcast Changesets get the short_id if present, otherwise the title
  def get_sources(%Ecto.Changeset{data: %Podcast{}} = changeset, _opts) do
    [
      case get_field(changeset, :short_id) do
        nil -> get_field(changeset, :title)
        short_id -> short_id
      end
    ]
  end

(https://github.com/podlove/radiator/blob/master/lib/radiator/directory/title_slug.ex#L15)

Don't quite have a clear idea yet how to move forward but wanted to write down my thoughts because the stated goal of the issue raised questions in me.

eteubert avatar Sep 26 '19 16:09 eteubert