chore(backend): add roslynator and fix diagnostics

This commit is contained in:
sam 2024-12-08 15:17:18 +01:00
parent 649988db25
commit f8e6032449
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
20 changed files with 60 additions and 38 deletions

View file

@ -38,7 +38,7 @@ public class AuthController(
if (config.DiscordAuth is { ClientId: not null, ClientSecret: not null })
{
discord =
$"https://discord.com/oauth2/authorize?response_type=code"
"https://discord.com/oauth2/authorize?response_type=code"
+ $"&client_id={config.DiscordAuth.ClientId}&scope=identify"
+ $"&prompt=none&state={state}"
+ $"&redirect_uri={HttpUtility.UrlEncode($"{config.BaseUrl}/auth/callback/discord")}";

View file

@ -104,7 +104,7 @@ public class DiscordAuthController(
);
string url =
$"https://discord.com/oauth2/authorize?response_type=code"
"https://discord.com/oauth2/authorize?response_type=code"
+ $"&client_id={config.DiscordAuth.ClientId}&scope=identify"
+ $"&prompt=none&state={state}"
+ $"&redirect_uri={HttpUtility.UrlEncode($"{config.BaseUrl}/auth/callback/discord")}";

View file

@ -48,7 +48,9 @@ public class EmailAuthController(
ct
)
)
{
return NoContent();
}
mailService.QueueAccountCreationEmail(req.Email, state);
return NoContent();

View file

@ -124,7 +124,9 @@ public class FlagsController(
}
}
else
{
_logger.Debug("Flag file {Hash} is used by other flags, not deleting", hash);
}
await tx.CommitAsync();

View file

@ -93,12 +93,14 @@ public partial class InternalController(DatabaseContext db) : ControllerBase
HttpMethodAttribute? httpMethodAttribute =
endpoint.Metadata.GetMetadata<HttpMethodAttribute>();
if (
httpMethodAttribute != null
&& !httpMethodAttribute.HttpMethods.Any(x =>
httpMethodAttribute?.HttpMethods.Any(x =>
x.Equals(requestMethod, StringComparison.OrdinalIgnoreCase)
)
) == false
)
{
continue;
}
return endpoint;
}

View file

@ -238,7 +238,7 @@ public class MembersController(
throw new ApiError.BadRequest(
"A member with that name already exists",
"name",
req.Name!
req.Name
);
}

View file

@ -135,7 +135,9 @@ public class UsersController(
else
{
if (TimeZoneInfo.TryFindSystemTimeZoneById(req.Timezone, out _))
{
user.Timezone = req.Timezone;
}
else
{
errors.Add(
@ -174,7 +176,7 @@ public class UsersController(
throw new ApiError.BadRequest(
"That username is already taken.",
"username",
req.Username!
req.Username
);
}