Skip to content

Commit 85155b4

Browse files
committed
feat: add function to sync GitHub data
1 parent ab28594 commit 85155b4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/algora/admin/admin.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ defmodule Algora.Admin do
2525

2626
require Logger
2727

28+
def sync_user(provider_login) do
29+
with {:ok, data} <- Github.get_user_by_username(token(), provider_login),
30+
{:ok, user} <- Workspace.ensure_user(token(), data["login"]) do
31+
user
32+
|> change(%{display_name: data["name"], location: data["location"]})
33+
|> Repo.update()
34+
end
35+
end
36+
2837
def backfill_charge(id) do
2938
with {:ok, tx} <- Repo.fetch_by(Transaction, id: id),
3039
{:ok,

0 commit comments

Comments
 (0)