Skip to content

Commit

Permalink
Merge pull request #156 from BUTR/code-formatting/fix-codeformatting
Browse files Browse the repository at this point in the history
Automated PR to fix formatting errors
  • Loading branch information
Aragas committed Dec 29, 2023
2 parents 8154b1c + 5e65a51 commit c9c845d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!");

Expand All @@ -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!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static bool OwnsTenantGame(this HttpContext context)
var typedMetadata = GetTypedMetadata(context.GetMetadata(), options);
return typedMetadata.GitHub;
}

public static ExternalDataHolder<DiscordOAuthTokens>? GetDiscordTokens(this HttpContext context)
{
var options = context.RequestServices.GetRequiredService<IOptions<JsonSerializerOptions>>().Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

Expand Down Expand Up @@ -79,4 +79,4 @@ protected override void Down(MigrationBuilder migrationBuilder)
schema: "nexusmods_user");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
Expand All @@ -21,7 +21,7 @@ public GitHubAPIClient(HttpClient httpClient)
{
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
}

public async Task<GitHubUserInfo?> GetUserInfoAsync(GitHubOAuthTokens tokens, CancellationToken ct)
{
using var response = await _httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Get, "user")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using BUTR.Site.NexusMods.Server.Options;
using BUTR.Site.NexusMods.Server.Options;

using Microsoft.Extensions.Options;

Expand All @@ -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;

Expand Down

0 comments on commit c9c845d

Please sign in to comment.