diff --git a/api/auth/backends/github.py b/api/auth/backends/github.py index 3770769..8b41f3f 100644 --- a/api/auth/backends/github.py +++ b/api/auth/backends/github.py @@ -63,7 +63,15 @@ def authenticate( # type: ignore[override] try: return Contributor.objects.get_or_create( - id=contributor_data["id"], defaults=contributor_data + id=contributor_data["id"], + defaults={ + "id": contributor_data["id"], + "email": contributor_data["email"], + "name": contributor_data["name"], + "location": contributor_data.get("location"), + "html_url": contributor_data["html_url"], + "avatar_url": contributor_data["avatar_url"], + }, )[0] # pylint: disable-next=bare-except except: diff --git a/api/migrations/0001_initial.py b/api/migrations/0001_initial.py index d4a3132..d0e5deb 100644 --- a/api/migrations/0001_initial.py +++ b/api/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.25 on 2024-08-08 10:28 +# Generated by Django 3.2.25 on 2024-09-06 11:54 import django.core.validators from django.db import migrations, models diff --git a/api/models/contributor.py b/api/models/contributor.py index df67475..015fa8b 100644 --- a/api/models/contributor.py +++ b/api/models/contributor.py @@ -17,6 +17,8 @@ class Contributor(models.Model): """A contributor that contributes to a repo""" + is_active = True + pk: int id = models.IntegerField( primary_key=True, help_text=_("The contributor's GitHub user-ID.") diff --git a/settings.py b/settings.py index bb3126b..c7820ca 100644 --- a/settings.py +++ b/settings.py @@ -23,8 +23,8 @@ GH_ORG = "ocadotechnology" GH_REPO = "codeforlife-workspace" GH_FILE = "CONTRIBUTING.md" -GH_CLIENT_ID = os.getenv("GITHUB_CLIENT_ID", "replace-me") -GH_CLIENT_SECRET = os.getenv("GITHUB_CLIENT_SECRET", "replace-me") +GH_CLIENT_ID = os.getenv("GH_CLIENT_ID", "Ov23liBErSabQFqROeMg") +GH_CLIENT_SECRET = os.getenv("GH_CLIENT_SECRET", "replace-me") AUTHENTICATION_BACKENDS = ["api.auth.backends.GitHubBackend"]