Skip to content

Commit a32240e

Browse files
committed
Rename Sync.Installation -> Sync.GithubAppInstallation to follow convention
1 parent f97aaee commit a32240e

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

lib/code_corps/github/sync/installation/changeset.ex renamed to lib/code_corps/github/sync/github_app_installation/changeset.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule CodeCorps.GitHub.Sync.Installation.Changeset do
1+
defmodule CodeCorps.GitHub.Sync.GithubAppInstallation.Changeset do
22
@moduledoc ~S"""
33
In charge of managing changesets when creating or updating a
44
`GithubAppInstallation` in the process of handling an Installation event.

lib/code_corps/github/sync/installation/installation.ex renamed to lib/code_corps/github/sync/github_app_installation/github_app_installation.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule CodeCorps.GitHub.Sync.Installation do
1+
defmodule CodeCorps.GitHub.Sync.GithubAppInstallation do
22
import Ecto.Query
33

44
alias CodeCorps.{GithubAppInstallation, GitHub.Sync, Repo, User}
@@ -89,14 +89,14 @@ defmodule CodeCorps.GitHub.Sync.Installation do
8989
@spec create_installation(map, User.t() | nil) :: commit_result()
9090
defp create_installation(%{} = payload, user \\ nil) do
9191
payload
92-
|> Sync.Installation.Changeset.create_changeset(user)
92+
|> Sync.GithubAppInstallation.Changeset.create_changeset(user)
9393
|> Repo.insert()
9494
end
9595

9696
@spec update_installation(GithubAppInstallation.t, map) :: commit_result()
9797
defp update_installation(%GithubAppInstallation{} = installation, %{} = payload) do
9898
installation
99-
|> Sync.Installation.Changeset.update_changeset(payload)
99+
|> Sync.GithubAppInstallation.Changeset.update_changeset(payload)
100100
|> Repo.update()
101101
end
102102
end

lib/code_corps/github/sync/sync.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ defmodule CodeCorps.GitHub.Sync do
288288
def installation_event(%{"action" => "created"} = payload) do
289289
multi =
290290
Multi.new
291-
|> Multi.run(:installation, fn _ -> payload |> Sync.Installation.sync() end)
291+
|> Multi.run(:installation, fn _ -> payload |> Sync.GithubAppInstallation.sync() end)
292292
|> Multi.run(:repos, fn %{installation: installation} -> installation |> Sync.GithubRepo.sync_installation() end)
293293

294294
case multi |> Repo.transaction() do

test/lib/code_corps/github/sync/installation/changeset_test.exs renamed to test/lib/code_corps/github/sync/github_app_installation/changeset_test.exs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
defmodule CodeCorps.GitHub.Event.Installation.ChangesetTest do
1+
defmodule CodeCorps.GitHub.Event.GithubAppInstallation.ChangesetTest do
22
@moduledoc false
33

44
use CodeCorps.DbAccessCase
55

66
import CodeCorps.GitHub.TestHelpers
77
alias CodeCorps.{
8-
GitHub.Sync.Installation,
8+
GitHub.Sync,
99
GithubAppInstallation
1010
}
1111
alias Ecto.Changeset
@@ -15,7 +15,8 @@ defmodule CodeCorps.GitHub.Event.Installation.ChangesetTest do
1515
test "assigns correct changes" do
1616
payload = load_event_fixture("installation_created")
1717

18-
changeset = payload |> Installation.Changeset.create_changeset()
18+
changeset =
19+
payload |> Sync.GithubAppInstallation.Changeset.create_changeset()
1920

2021
assert changeset |> Changeset.get_change(:github_id) == payload["installation"]["id"]
2122
assert changeset |> Changeset.get_change(:github_account_id) == payload["installation"]["account"]["id"]
@@ -34,7 +35,8 @@ defmodule CodeCorps.GitHub.Event.Installation.ChangesetTest do
3435
payload = load_event_fixture("installation_created")
3536
user = insert(:user)
3637

37-
changeset = payload |> Installation.Changeset.create_changeset(user)
38+
changeset =
39+
payload |> Sync.GithubAppInstallation.Changeset.create_changeset(user)
3840

3941
assert changeset |> Changeset.get_change(:user) |> Map.get(:data) == user
4042
assert changeset.valid?
@@ -47,7 +49,8 @@ defmodule CodeCorps.GitHub.Event.Installation.ChangesetTest do
4749
github_app_installation = %GithubAppInstallation{}
4850

4951
changeset =
50-
github_app_installation |> Installation.Changeset.update_changeset(payload)
52+
github_app_installation
53+
|> Sync.GithubAppInstallation.Changeset.update_changeset(payload)
5154

5255
assert changeset |> Changeset.get_change(:github_id) == payload["installation"]["id"]
5356
assert changeset |> Changeset.get_change(:github_account_id) == payload["installation"]["account"]["id"]

0 commit comments

Comments
 (0)