🎨 Removed unused dependency injected services arguments in constructor

This commit is contained in:
LittleSheep 2025-06-21 14:32:59 +08:00
parent eadf25f389
commit 1baa3109bc
12 changed files with 9 additions and 18 deletions

View File

@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using DysonNetwork.Sphere.Auth;
using DysonNetwork.Sphere.Permission;
using DysonNetwork.Sphere.Storage;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@ -15,11 +14,9 @@ namespace DysonNetwork.Sphere.Account;
[Route("/accounts")]
public class AccountController(
AppDatabase db,
FileService fs,
AuthService auth,
AccountService accounts,
AccountEventService events,
MagicSpellService spells
AccountEventService events
) : ControllerBase
{
[HttpGet("{name}")]

View File

@ -10,7 +10,6 @@ namespace DysonNetwork.Sphere.Account;
public class NotificationService(
AppDatabase db,
WebSocketService ws,
ILogger<NotificationService> logger,
IHttpClientFactory httpFactory,
IConfiguration config)
{

View File

@ -58,7 +58,7 @@ public class AuthService(AppDatabase db, IConfiguration config, IHttpClientFacto
// 4) Combine base “maxSteps” (the number of enabled factors) with any accumulated risk score.
const int totalRiskScore = 3;
var totalRequiredSteps = (int)Math.Round((float)maxSteps * riskScore / 3);
var totalRequiredSteps = (int)Math.Round((float)maxSteps * riskScore / totalRiskScore);
// Clamp the steps
totalRequiredSteps = Math.Max(Math.Min(totalRequiredSteps, maxSteps), 1);

View File

@ -304,7 +304,7 @@ public class ConnectionController(
{
await db.SaveChangesAsync();
}
catch (DbUpdateException ex)
catch (DbUpdateException)
{
return StatusCode(500, $"Failed to save {provider} connection. Please try again.");
}

View File

@ -33,15 +33,15 @@ public class DiscordOidcService(
return $"https://discord.com/api/oauth2/authorize?{queryString}";
}
protected override async Task<OidcDiscoveryDocument?> GetDiscoveryDocumentAsync()
protected override Task<OidcDiscoveryDocument?> GetDiscoveryDocumentAsync()
{
return new OidcDiscoveryDocument
return Task.FromResult(new OidcDiscoveryDocument
{
AuthorizationEndpoint = "https://discord.com/oauth2/authorize",
TokenEndpoint = "https://discord.com/api/oauth2/token",
UserinfoEndpoint = "https://discord.com/api/users/@me",
JwksUri = null
};
})!;
}
public override async Task<OidcUserInfo> ProcessCallbackAsync(OidcCallbackData callbackData)

View File

@ -16,7 +16,6 @@ namespace DysonNetwork.Sphere.Chat;
[Route("/chat")]
public class ChatRoomController(
AppDatabase db,
FileService fs,
FileReferenceService fileRefService,
ChatRoomService crs,
RealmService rs,

View File

@ -9,7 +9,6 @@ namespace DysonNetwork.Sphere.Chat;
public class ChatService(
AppDatabase db,
FileService fs,
FileReferenceService fileRefService,
IServiceScopeFactory scopeFactory,
IRealtimeService realtime,

View File

@ -16,7 +16,6 @@ namespace DysonNetwork.Sphere.Publisher;
public class PublisherController(
AppDatabase db,
PublisherService ps,
FileService fs,
FileReferenceService fileRefService,
ActionLogService als)
: ControllerBase

View File

@ -6,7 +6,7 @@ using NodaTime;
namespace DysonNetwork.Sphere.Publisher;
public class PublisherService(AppDatabase db, FileService fs, FileReferenceService fileRefService, ICacheService cache)
public class PublisherService(AppDatabase db, FileReferenceService fileRefService, ICacheService cache)
{
private const string UserPublishersCacheKey = "accounts:{0}:publishers";

View File

@ -13,7 +13,6 @@ namespace DysonNetwork.Sphere.Realm;
public class RealmController(
AppDatabase db,
RealmService rs,
FileService fs,
FileReferenceService fileRefService,
RelationshipService rels,
ActionLogService als

View File

@ -6,7 +6,6 @@ namespace DysonNetwork.Sphere.Storage;
public class CloudFileUnusedRecyclingJob(
AppDatabase db,
FileService fs,
FileReferenceService fileRefService,
ILogger<CloudFileUnusedRecyclingJob> logger
)

View File

@ -6,8 +6,8 @@ namespace DysonNetwork.Sphere.Storage.Handlers;
public class LastActiveInfo
{
public Auth.Session Session { get; set; }
public Account.Account Account { get; set; }
public Auth.Session Session { get; set; } = null!;
public Account.Account Account { get; set; } = null!;
public Instant SeenAt { get; set; }
}