Packages

This library is a summary of the functions that are generally required for Matching Web service development.

Current section

Files

Jump to
servicex_matching lib servicex_matching messages application.ex
Raw

lib/servicex_matching/messages/application.ex

defmodule ServicexMatching.Messages.Application do
use Ecto.Schema
import Ecto.Changeset
schema "applications" do
field :application_type, :integer
field :answer_message, :string
field :application_message, :string
field :status, :integer
field :project_id, :id
field :from_user_profile_id, :id
field :to_user_profile_id, :id
field :lock_version, :integer, default: 0
timestamps()
end
@doc false
def changeset(application, attrs) do
application
|> cast(attrs, [:application_type, :status, :application_message, :answer_message])
|> validate_required([:status, :application_message, :answer_message])
|> optimistic_lock(:lock_version)
end
def application_type() do
%{
offer: 1, # 募集者から参加者へのオファー
entry: 2, # 参加者から募集者へのエントリー
}
end
def status() do
%{
new: 1, #新規
accept: 2, #承認
reject: 8, #拒否
canceled: 9, #キャンセル
}
end
def get_status_disp(status_value) do
disp_map = %{
1 => "新規",
2 => "承認",
8 => "拒否",
9 => "キャンセル",
}
disp_map[status_value]
end
end