From 04d6f323257de4a88874ef6c8f7cc89a492a1285 Mon Sep 17 00:00:00 2001 From: Thelonius Kort Date: Thu, 5 Jan 2023 22:25:35 +0100 Subject: [PATCH] Update DeeplAccount Less required fields, default for character_count and association. --- lib/outlook/translators/deepl_account.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/outlook/translators/deepl_account.ex b/lib/outlook/translators/deepl_account.ex index 7c67cae..2c8c764 100644 --- a/lib/outlook/translators/deepl_account.ex +++ b/lib/outlook/translators/deepl_account.ex @@ -4,12 +4,13 @@ defmodule Outlook.Translators.DeeplAccount do schema "deepl_accounts" do field :auth_key, :string - field :character_count, :integer + 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 @@ -18,6 +19,6 @@ defmodule Outlook.Translators.DeeplAccount do 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, :character_count, :our_character_count]) + |> validate_required([:name, :description, :auth_key, :character_limit]) end end