diff --git a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/IntegrationGitHubTokensEntityConfiguration.cs b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/IntegrationGitHubTokensEntityConfiguration.cs index cc3e03b9..0a2a4b54 100644 --- a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/IntegrationGitHubTokensEntityConfiguration.cs +++ b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/IntegrationGitHubTokensEntityConfiguration.cs @@ -1,4 +1,4 @@ -using BUTR.Site.NexusMods.Server.Models; +using BUTR.Site.NexusMods.Server.Models; using BUTR.Site.NexusMods.Server.Models.Database; using Microsoft.EntityFrameworkCore; diff --git a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToIntegrationGitHubEntityConfiguration.cs b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToIntegrationGitHubEntityConfiguration.cs index 9624b570..38dd1093 100644 --- a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToIntegrationGitHubEntityConfiguration.cs +++ b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToIntegrationGitHubEntityConfiguration.cs @@ -1,4 +1,4 @@ -using BUTR.Site.NexusMods.Server.Models; +using BUTR.Site.NexusMods.Server.Models; using BUTR.Site.NexusMods.Server.Models.Database; using Microsoft.EntityFrameworkCore; diff --git a/src/BUTR.Site.NexusMods.Server/Controllers/GitHubController.cs b/src/BUTR.Site.NexusMods.Server/Controllers/GitHubController.cs index c179c5ff..42b77d96 100644 --- a/src/BUTR.Site.NexusMods.Server/Controllers/GitHubController.cs +++ b/src/BUTR.Site.NexusMods.Server/Controllers/GitHubController.cs @@ -50,7 +50,7 @@ public GitHubController(GitHubClient gitHubClient, GitHubAPIClient gitHubApiClie return ApiBadRequest("Failed to link!"); var userInfo = await _gitHubApiClient.GetUserInfoAsync(tokens, ct); - + if (userInfo is null || !await _gitHubStorage.UpsertAsync(userId, userInfo.Id.ToString(), tokens)) return ApiBadRequest("Failed to link!"); @@ -71,7 +71,7 @@ public GitHubController(GitHubClient gitHubClient, GitHubAPIClient gitHubApiClie //if (tokens.Data.AccessToken != refreshed.AccessToken) // await _discordStorage.UpsertAsync(userId, tokens.ExternalId, refreshed); - + if (!await _gitHubStorage.RemoveAsync(userId, tokens.ExternalId)) return ApiBadRequest("Failed to unlink!"); diff --git a/src/BUTR.Site.NexusMods.Server/Extensions/HttpContextExtensions.cs b/src/BUTR.Site.NexusMods.Server/Extensions/HttpContextExtensions.cs index 0c8428b2..50601ab8 100644 --- a/src/BUTR.Site.NexusMods.Server/Extensions/HttpContextExtensions.cs +++ b/src/BUTR.Site.NexusMods.Server/Extensions/HttpContextExtensions.cs @@ -144,7 +144,7 @@ public static bool OwnsTenantGame(TenantId tenant, Dictionary me var typedMetadata = GetTypedMetadata(context.GetMetadata(), options); return typedMetadata.GitHub; } - + public static ExternalDataHolder? GetDiscordTokens(this HttpContext context) { var options = context.RequestServices.GetRequiredService>().Value; diff --git a/src/BUTR.Site.NexusMods.Server/Migrations/20231226222434_GitHub.cs b/src/BUTR.Site.NexusMods.Server/Migrations/20231226222434_GitHub.cs index d274658a..8d589d23 100644 --- a/src/BUTR.Site.NexusMods.Server/Migrations/20231226222434_GitHub.cs +++ b/src/BUTR.Site.NexusMods.Server/Migrations/20231226222434_GitHub.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -79,4 +79,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: "nexusmods_user"); } } -} +} \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubAPIClient.cs b/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubAPIClient.cs index 0fbfa700..bb1c9ca4 100644 --- a/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubAPIClient.cs +++ b/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubAPIClient.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text.Json; @@ -21,7 +21,7 @@ public GitHubAPIClient(HttpClient httpClient) { _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); } - + public async Task GetUserInfoAsync(GitHubOAuthTokens tokens, CancellationToken ct) { using var response = await _httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Get, "user") diff --git a/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubClient.cs b/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubClient.cs index 53d471ab..6418b486 100644 --- a/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubClient.cs +++ b/src/BUTR.Site.NexusMods.Server/Services/HttpClients/GitHubClient.cs @@ -1,4 +1,4 @@ -using BUTR.Site.NexusMods.Server.Options; +using BUTR.Site.NexusMods.Server.Options; using Microsoft.Extensions.Options; @@ -20,7 +20,7 @@ public sealed record GitHubOAuthTokensResponse( [property: JsonPropertyName("access_token")] string AccessToken, [property: JsonPropertyName("scope")] string Scope, [property: JsonPropertyName("token_type")] string TokenType); - + private readonly HttpClient _httpClient; private readonly GitHubOptions _options;