We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0c434a commit 6a141a4Copy full SHA for 6a141a4
lib/cadet/ai_comments/ai_comment.ex
@@ -18,17 +18,13 @@ defmodule Cadet.AIComments.AIComment do
18
timestamps()
19
end
20
21
+ @required_fields ~w(answer_id raw_prompt answers_json)a
22
+ @optional_fields ~w(response error final_comment)a
23
+
24
def changeset(ai_comment, attrs) do
25
ai_comment
- |> cast(attrs, [
- :answer_id,
- :raw_prompt,
26
- :answers_json,
27
- :response,
28
- :error,
29
- :final_comment
30
- ])
31
- |> validate_required([:answer_id, :raw_prompt, :answers_json])
+ |> cast(attrs, @required_fields ++ @optional_fields)
+ |> validate_required(@required_fields)
32
|> foreign_key_constraint(:answer_id)
33
34
0 commit comments