initial shift template live view progress
This commit is contained in:
parent
73c97f194b
commit
57c8b5b322
9 changed files with 98 additions and 39 deletions
lib/shift73k
|
@ -21,6 +21,11 @@ defmodule Shift73k.ShiftTemplates do
|
|||
Repo.all(ShiftTemplate)
|
||||
end
|
||||
|
||||
def list_shift_templates_by_user_id(user_id) do
|
||||
(from s in ShiftTemplate, where: s.user_id == ^user_id)
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single shift_template.
|
||||
|
||||
|
|
|
@ -2,17 +2,20 @@ defmodule Shift73k.ShiftTemplates.ShiftTemplate do
|
|||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@app_vars Application.get_env(:shift73k, :app_global_vars, time_zone: "America/New_York")
|
||||
@time_zone @app_vars[:time_zone]
|
||||
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
schema "shift_templates" do
|
||||
field :label, :string
|
||||
field :subject, :string
|
||||
field :subject, :string, default: "My Work Shift"
|
||||
field :description, :string
|
||||
field :location, :string
|
||||
field :timezone, :string
|
||||
field :start_time, :time
|
||||
field :length_hours, :integer
|
||||
field :length_minutes, :integer
|
||||
field :timezone, :string, default: @time_zone
|
||||
field :start_time, :time, default: ~T[09:00:00]
|
||||
field :length_hours, :integer, default: 8
|
||||
field :length_minutes, :integer, default: 0
|
||||
|
||||
belongs_to(:user, Shift73k.Accounts.User)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue