[day-04] add exercise schema

So a training is a collection of exercises that have a description and a
protocol to be followed.
This commit is contained in:
Joao P Dubas
2021-06-26 17:23:27 +00:00
parent ea5616addf
commit 58c4601203
3 changed files with 48 additions and 0 deletions

View File

@@ -17,6 +17,8 @@ defmodule Wabanex.Training do
belongs_to :user, User
has_many :exercises, Exercise
timestamps()
end
@@ -24,5 +26,6 @@ defmodule Wabanex.Training do
%__MODULE__{}
|> cast(params, @fields)
|> validate_required(@required_fields)
|> cast_assoc(:exercises)
end
end