Fix user/deepl_account relation

This commit is contained in:
Thelonius Kort
2023-01-09 21:09:46 +01:00
parent 6faf1e02f5
commit 54250a5a95
4 changed files with 6 additions and 5 deletions

View File

@ -9,8 +9,7 @@ defmodule Outlook.Translators.DeeplAccount do
field :description, :string
field :name, :string
field :our_character_count, :integer
field :user_id, :id
belongs_to :users, User
belongs_to :user, Outlook.Accounts.User
timestamps()
end
@ -18,7 +17,7 @@ defmodule Outlook.Translators.DeeplAccount do
@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])
|> cast(attrs, [:name, :description, :auth_key, :character_limit, :character_count, :our_character_count, :user_id])
|> validate_required([:name, :description, :auth_key, :character_limit, :user_id])
end
end