Skip to content

Commit 49e7695

Browse files
committed
add Admin.seed_installation/2
1 parent fd0ba23 commit 49e7695

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/algora/admin/admin.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,14 @@ defmodule Algora.Admin do
885885
error -> {:error, error}
886886
end
887887

888+
def seed_installation(installation_id, user_id) do
889+
with {:ok, installation} <- Github.get_installation(installation_id),
890+
{:ok, user} <- Repo.fetch_by(User, id: user_id),
891+
{:ok, org} <- Repo.fetch_by(User, provider: "github", provider_id: to_string(installation["target_id"])) do
892+
Workspace.upsert_installation(installation, user, org, user)
893+
end
894+
end
895+
888896
defp update_installation(installation) do
889897
target_user =
890898
Repo.get_by(User,

0 commit comments

Comments
 (0)