2021-09-01 12:43:55 +00:00
|
|
|
defmodule ArchitexWeb.Client.Request.Ban do
|
2021-09-09 15:26:40 +00:00
|
|
|
use ArchitexWeb.APIRequest
|
2021-08-26 20:09:45 +00:00
|
|
|
|
2021-09-13 10:42:56 +00:00
|
|
|
alias Architex.Types.UserId
|
|
|
|
|
2021-08-26 20:09:45 +00:00
|
|
|
@type t :: %__MODULE__{
|
2021-09-13 10:42:56 +00:00
|
|
|
user_id: UserId.t(),
|
2021-08-26 20:09:45 +00:00
|
|
|
reason: String.t() | nil
|
|
|
|
}
|
|
|
|
|
|
|
|
@primary_key false
|
|
|
|
embedded_schema do
|
2021-09-13 10:42:56 +00:00
|
|
|
field :user_id, UserId
|
2021-08-26 20:09:45 +00:00
|
|
|
field :reason, :string
|
|
|
|
end
|
|
|
|
|
|
|
|
def changeset(data, params) do
|
|
|
|
data
|
|
|
|
|> cast(params, [:user_id, :reason])
|
|
|
|
|> validate_required([:user_id])
|
|
|
|
end
|
|
|
|
end
|