frenzy/lib/frenzy/fervor_client.ex

32 lines
762 B
Elixir

defmodule Frenzy.FervorClient do
use Ecto.Schema
import Ecto.Changeset
def to_fervor(client) do
%{
client_name: client.client_name,
website: client.website,
redirect_uri: client.redirect_uri,
client_id: client.client_id,
client_secret: client.client_secret
}
end
schema "fervor_clients" do
field :client_name, :string
field :website, :string
field :redirect_uri, :string
field :client_id, :string
field :client_secret, :string
timestamps()
end
@doc false
def changeset(client, attrs) do
client
|> cast(attrs, [:client_name, :website, :redirect_uri, :client_id, :client_secret])
|> validate_required([:client_name, :redirect_uri, :client_id, :client_secret])
end
end