calendar slug added, settings quick change working
This commit is contained in:
parent
56b72f8038
commit
873723d776
7 changed files with 88 additions and 1 deletions
lib/shift73k
|
@ -473,4 +473,15 @@ defmodule Shift73k.Accounts do
|
|||
|> where(id: ^user_id)
|
||||
|> Repo.update_all(set: [week_start_at: day])
|
||||
end
|
||||
|
||||
## Calendar slug
|
||||
|
||||
@doc """
|
||||
Sets a new calendar url slug for user
|
||||
"""
|
||||
def change_user_calendar_slug(user_id) do
|
||||
User
|
||||
|> where(id: ^user_id)
|
||||
|> Repo.update_all(set: [calendar_slug: Ecto.UUID.generate()])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,7 @@ defmodule Shift73k.Accounts.User do
|
|||
field(:password, :string, virtual: true)
|
||||
field(:hashed_password, :string)
|
||||
field(:confirmed_at, :naive_datetime)
|
||||
field(:calendar_slug, :string, default: Ecto.UUID.generate())
|
||||
|
||||
field(:role, Ecto.Enum, values: Keyword.keys(@roles), default: :user)
|
||||
field(:week_start_at, Ecto.Enum, values: weekdays(), default: :monday)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue