-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We can build this in a separate service, let's keep the scope small
- Loading branch information
1 parent
2d2eedb
commit 8eef749
Showing
15 changed files
with
46 additions
and
269 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
kmicms/accounts/migrations/0003_remove_discord_integration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.10 on 2024-02-10 14:15 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("accounts", "0002_discord_accounts"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="discordconnection", | ||
name="discord_account", | ||
), | ||
migrations.RemoveField( | ||
model_name="discordconnection", | ||
name="user", | ||
), | ||
migrations.DeleteModel( | ||
name="DiscordAccount", | ||
), | ||
migrations.DeleteModel( | ||
name="DiscordConnection", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,7 @@ | ||
from __future__ import annotations | ||
|
||
from django.contrib.auth.models import AbstractUser | ||
from django.db import models | ||
|
||
|
||
class User(AbstractUser): | ||
pass | ||
|
||
|
||
class DiscordAccount(models.Model): | ||
discord_id = models.PositiveBigIntegerField(unique=True) | ||
username = models.CharField(max_length=255, unique=True) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
|
||
def __str__(self) -> str: | ||
return f"@{self.username}" | ||
|
||
|
||
class DiscordConnection(models.Model): | ||
user = models.OneToOneField( | ||
User, on_delete=models.CASCADE, related_name="discord_connection", related_query_name="discord_connection" | ||
) | ||
discord_account = models.OneToOneField( | ||
DiscordAccount, | ||
on_delete=models.CASCADE, | ||
related_name="discord_connection", | ||
related_query_name="discord_connection", | ||
) | ||
access_token = models.CharField(max_length=30) | ||
refresh_token = models.CharField(max_length=30) | ||
access_token_expires_at = models.DateTimeField() | ||
|
||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
|
||
def __str__(self) -> str: | ||
return f"Discord Connection for {self.user} to {self.discord_account}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
kmicms/accounts/templates/accounts/discord_account_disconnect.html
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.