Skip to content

Commit

Permalink
Merge pull request #58 from karabiner-inc/develop
Browse files Browse the repository at this point in the history
Master反映用PR
  • Loading branch information
kemmy-arinaga committed Dec 16, 2019
2 parents 2ceafad + 6927cb3 commit 4254756
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 34 deletions.
40 changes: 30 additions & 10 deletions lib/materia/accounts/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "living",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -96,7 +98,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "billing",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: nil,
Expand Down Expand Up @@ -279,7 +283,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "billing",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -302,7 +308,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "living",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: nil,
Expand Down Expand Up @@ -491,7 +499,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "billing",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -514,7 +524,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "living",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: nil,
Expand Down Expand Up @@ -878,7 +890,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "billing",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -901,7 +915,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "living",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: nil,
Expand Down Expand Up @@ -1128,7 +1144,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "billing",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -1151,7 +1169,9 @@ defmodule Materia.Accounts do
fax_number: "fax_number",
subject: "living",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: nil,
Expand Down
10 changes: 8 additions & 2 deletions lib/materia/locations/address.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ defmodule Materia.Locations.Address do
field(:zip_code, :string)
field(:subject, :string)
field(:lock_version, :integer, default: 0)
field(:status, :integer, default: 1)
field(:area_code, :string)
belongs_to(:user, Materia.Accounts.User)
belongs_to(:organization, Materia.Organizations.Organization)

Expand Down Expand Up @@ -51,7 +53,9 @@ defmodule Materia.Locations.Address do
:notation_org_name_p,
:notation_name,
:notation_name_p,
:fax_number
:fax_number,
:status,
:area_code
])
|> validate_required([:subject])
end
Expand Down Expand Up @@ -79,7 +83,9 @@ defmodule Materia.Locations.Address do
:notation_org_name_p,
:notation_name,
:notation_name_p,
:fax_number
:fax_number,
:status,
:area_code
])
|> validate_required([:lock_version])
|> optimistic_lock(:lock_version)
Expand Down
18 changes: 13 additions & 5 deletions lib/materia/locations/locations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ defmodule Materia.Locations do
role: "admin",
status: 1
},
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
```
Expand Down Expand Up @@ -110,7 +112,9 @@ defmodule Materia.Locations do
role: "admin",
status: 1
},
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
```
Expand All @@ -130,7 +134,7 @@ defmodule Materia.Locations do
## Examples
```
iex(1)> {:ok, address} = Materia.Locations.create_address(%{subject: "living"})
iex(1)> {:ok, address} = Materia.Locations.create_address(%{subject: "living", area_code: "TEST"})
iex(2)> MateriaWeb.AddressView.render("show.json", %{address: address}) |> Map.delete(:id)
%{
address1: nil,
Expand All @@ -152,7 +156,9 @@ defmodule Materia.Locations do
fax_number: nil,
subject: "living",
user: [],
zip_code: nil
zip_code: nil,
area_code: "TEST",
status: 1
}
```
Expand Down Expand Up @@ -212,7 +218,9 @@ defmodule Materia.Locations do
role: "admin",
status: 1
},
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
```
Expand Down
24 changes: 18 additions & 6 deletions lib/materia/organizations/organizations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ defmodule Materia.Organizations do
fax_number: "fax_number",
subject: "branch",
user: [],
zip_code: "812-ZZZZ"
zip_code: "812-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -69,7 +71,9 @@ defmodule Materia.Organizations do
fax_number: "fax_number",
subject: "registry",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: "https://hogehoge.com/ib_img.jpg",
Expand Down Expand Up @@ -150,7 +154,9 @@ defmodule Materia.Organizations do
fax_number: "fax_number",
subject: "branch",
user: [],
zip_code: "812-ZZZZ"
zip_code: "812-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -173,7 +179,9 @@ defmodule Materia.Organizations do
fax_number: "fax_number",
subject: "registry",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: "https://hogehoge.com/ib_img.jpg",
Expand Down Expand Up @@ -325,7 +333,9 @@ defmodule Materia.Organizations do
fax_number: "fax_number",
subject: "branch",
user: [],
zip_code: "812-ZZZZ"
zip_code: "812-ZZZZ",
area_code: nil,
status: 1
},
%{
address1: "福岡市中央区",
Expand All @@ -348,7 +358,9 @@ defmodule Materia.Organizations do
fax_number: "fax_number",
subject: "registry",
user: [],
zip_code: "810-ZZZZ"
zip_code: "810-ZZZZ",
area_code: nil,
status: 1
}
],
back_ground_img_url: "https://hogehoge.com/ib_img.jpg",
Expand Down
4 changes: 3 additions & 1 deletion lib/materia_web/views/address_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ defmodule MateriaWeb.AddressView do
latitude: address.latitude,
longitude: address.longitude,
subject: address.subject,
lock_version: address.lock_version
lock_version: address.lock_version,
area_code: address.area_code,
status: address.status
}

result_map =
Expand Down
10 changes: 10 additions & 0 deletions lib/mix/templates/017_add_column_address..exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defmodule Materia.Repo.Migrations.AddColumnAddresses do
use Ecto.Migration

def change do
alter table(:addresses) do
add(:status, :integer)
add(:area_code, :string)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defmodule Materia.Repo.Migrations.AddColumnAddresses do
use Ecto.Migration

def change do
alter table(:addresses) do
add(:status, :integer)
add(:area_code, :string)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ defmodule MateriaWeb.AuthenticatorControllerTest do
"notation_org_name_p" => "notation_org_name_p",
"notation_name_p" => "notation_name_p",
"phone_number" => "phone_number",
"fax_number" => "fax_number"
"fax_number" => "fax_number",
"area_code" => nil,
"status" => 1
},
%{
"address1" => "福岡市中央区",
Expand All @@ -146,7 +148,9 @@ defmodule MateriaWeb.AuthenticatorControllerTest do
"notation_org_name_p" => "notation_org_name_p",
"notation_name_p" => "notation_name_p",
"phone_number" => "phone_number",
"fax_number" => "fax_number"
"fax_number" => "fax_number",
"area_code" => nil,
"status" => 1
}
],
"back_ground_img_url" => nil,
Expand Down

0 comments on commit 4254756

Please sign in to comment.