Files
phoenix-ausblick/lib/outlook/translators/deepl_account.ex
Thelonius Kort 04d6f32325 Update DeeplAccount
Less required fields, default for character_count and association.
2023-01-05 22:25:35 +01:00

25 lines
678 B
Elixir

defmodule Outlook.Translators.DeeplAccount do
use Ecto.Schema
import Ecto.Changeset
schema "deepl_accounts" do
field :auth_key, :string
field :character_count, :integer, default: 0
field :character_limit, :integer
field :description, :string
field :name, :string
field :our_character_count, :integer
field :user_id, :id
belongs_to :users, User
timestamps()
end
@doc false
def changeset(deepl_account, attrs) do
deepl_account
|> cast(attrs, [:name, :description, :auth_key, :character_limit, :character_count, :our_character_count])
|> validate_required([:name, :description, :auth_key, :character_limit])
end
end