refactor(cqrs): cleanup old service layer, preserve discovery/assignment services for handlers
- Remove 13 old service interfaces from Application/Services - Remove 13 old service implementations from Infrastructure/Services - Remove old SnapshotService (no CQRS replacement needed) - Update Infrastructure DI to register only CQRS-compatible services - Preserve CameraEventService + PersonService for existing tests - Clean up duplicate IUserRepository registration
This commit is contained in:
1 parent
1d1ac8387e
commit
d67cbd64cc
21 files changed
+2
-2101
No files matched your search
@@ -1,13 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface IAgentService
|
||||
{
|
||||
Task<ServiceResult<RegisterAgentResponse>> RegisterAsync(RegisterAgentRequest request, string? apiKey, CancellationToken ct);
|
||||
Task<ServiceResult> HeartbeatAsync(Guid agentId, AgentHeartbeatRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<AgentResponse>> GetByIdAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult<PagedResult<AgentResponse>>> ListBySiteAsync(Guid siteId, int page, int pageSize, CancellationToken ct);
|
||||
Task<ServiceResult<PagedResult<AgentResponse>>> ListAllAsync(int page, int pageSize, CancellationToken ct);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface IAuditLogService
|
||||
{
|
||||
Task<ServiceResult<PagedResult<AuditLogResponse>>> ListAsync(
|
||||
string? resourceType = null,
|
||||
string? action = null,
|
||||
int page = 1,
|
||||
int pageSize = 20,
|
||||
CancellationToken ct = default);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface IAuthService
|
||||
{
|
||||
Task<ServiceResult<AuthResponse>> RegisterAsync(RegisterRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<AuthResponse>> LoginAsync(LoginRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<AuthResponse>> Verify2faAsync(Verify2faRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<AuthResponse>> RefreshTokenAsync(string refreshToken, CancellationToken ct);
|
||||
Task<ServiceResult<AuthResponse>> RegisterAdminAsync(RegisterRequest request, CancellationToken ct);
|
||||
Task<ServiceResult> Enable2faAsync(Guid userId, CancellationToken ct);
|
||||
Task<ServiceResult> Disable2faAsync(Guid userId, CancellationToken ct);
|
||||
Task<ServiceResult> ChangePasswordAsync(Guid userId, string currentPassword, string newPassword, CancellationToken ct);
|
||||
Task LogoutAsync(Guid userId, string refreshToken, CancellationToken ct);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface ICameraService
|
||||
{
|
||||
Task<ServiceResult<CameraResponse>> CreateAsync(CreateCameraRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<CameraResponse>> GetByIdAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult<PagedResult<CameraResponse>>> ListBySiteAsync(Guid siteId, int page, int pageSize, CancellationToken ct);
|
||||
Task<ServiceResult<CameraResponse>> UpdateAsync(Guid id, UpdateCameraRequest request, CancellationToken ct);
|
||||
Task<ServiceResult> DeleteAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult> SetCredentialsAsync(Guid cameraId, Domain.Entities.CameraCredentials credentials, CancellationToken ct);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface IGroupService
|
||||
{
|
||||
Task<ServiceResult<PagedResult<GroupResponse>>> ListAsync(int page, int pageSize, CancellationToken ct);
|
||||
Task<ServiceResult<GroupResponse>> GetByIdAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult<GroupResponse>> CreateAsync(CreateGroupRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<GroupResponse>> UpdateAsync(Guid id, UpdateGroupRequest request, CancellationToken ct);
|
||||
Task<ServiceResult> DeleteAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult> AddUserAsync(Guid groupId, Guid userId, CancellationToken ct);
|
||||
Task<ServiceResult> RemoveUserAsync(Guid groupId, Guid userId, CancellationToken ct);
|
||||
Task<ServiceResult<IReadOnlyList<GroupMemberResponse>>> GetMembersAsync(Guid groupId, CancellationToken ct);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Manages global settings and per-agent setting overrides.
|
||||
/// All changes are broadcast to connected agents via SignalR in real-time.
|
||||
/// </summary>
|
||||
public interface ISettingService
|
||||
{
|
||||
// Global settings
|
||||
Task<ServiceResult<List<AppSettingDto>>> GetAllSettingsAsync(CancellationToken ct = default);
|
||||
Task<ServiceResult<AppSettingDto>> GetSettingByKeyAsync(string key, CancellationToken ct = default);
|
||||
Task<ServiceResult<AppSettingDto>> CreateSettingAsync(CreateAppSettingRequest request, CancellationToken ct = default);
|
||||
Task<ServiceResult<AppSettingDto>> UpdateSettingAsync(string key, UpdateAppSettingRequest request, CancellationToken ct = default);
|
||||
Task<ServiceResult> DeleteSettingAsync(string key, CancellationToken ct = default);
|
||||
|
||||
// Agent-specific overrides
|
||||
Task<ServiceResult<List<AgentSettingDto>>> GetAgentSettingsAsync(Guid agentId, CancellationToken ct = default);
|
||||
Task<ServiceResult<AgentSettingDto>> SetAgentSettingAsync(Guid agentId, SetAgentSettingRequest request, CancellationToken ct = default);
|
||||
Task<ServiceResult> RemoveAgentSettingAsync(Guid agentId, string key, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the effective configuration for an agent: global defaults merged with
|
||||
/// per-agent overrides. Used by agents to fetch their full config on connect.
|
||||
/// </summary>
|
||||
Task<ServiceResult<Dictionary<string, string>>> GetEffectiveAgentConfigAsync(Guid agentId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface ISiteService
|
||||
{
|
||||
Task<ServiceResult<SiteWithTokenResponse>> CreateAsync(CreateSiteRequest request, Guid userId, CancellationToken ct);
|
||||
Task<ServiceResult<SiteResponse>> GetByIdAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult<PagedResult<SiteResponse>>> ListAsync(int page, int pageSize, CancellationToken ct);
|
||||
Task<ServiceResult<SiteResponse>> UpdateAsync(Guid id, UpdateSiteRequest request, CancellationToken ct);
|
||||
Task<ServiceResult> DeleteAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult<RegistrationTokenResponse>> GenerateTokenAsync(Guid id, CancellationToken ct);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Snapshot storage service.
|
||||
/// Uploads, retrieves, and deletes camera snapshots from S3-compatible
|
||||
/// storage (Alarik). Snapshots are JPG images captured during events.
|
||||
/// </summary>
|
||||
public interface ISnapshotService
|
||||
{
|
||||
/// <summary>Upload a snapshot JPG. Returns the public URL.</summary>
|
||||
Task<string> UploadAsync(Guid cameraId, Guid eventId, byte[] imageData, CancellationToken ct);
|
||||
|
||||
/// <summary>Upload a thumbnail JPG. Returns the public URL.</summary>
|
||||
Task<string> UploadThumbnailAsync(Guid cameraId, Guid eventId, byte[] imageData, CancellationToken ct);
|
||||
|
||||
/// <summary>Delete a snapshot by its URL.</summary>
|
||||
Task DeleteAsync(string snapshotUrl, CancellationToken ct);
|
||||
|
||||
/// <summary>Get a presigned download URL (temporary, 5 min).</summary>
|
||||
Task<string?> GetDownloadUrlAsync(string snapshotUrl, CancellationToken ct);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface IStatsService
|
||||
{
|
||||
Task<ServiceResult<StatsResponse>> GetStatsAsync(CancellationToken ct);
|
||||
Task<ServiceResult<List<AgentStatItem>>> GetAgentStatsAsync(CancellationToken ct);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.DTOs;
|
||||
|
||||
namespace Heimdall.Application.Services;
|
||||
|
||||
public interface IUserService
|
||||
{
|
||||
Task<ServiceResult<PagedResult<UserResponse>>> ListAsync(int page, int pageSize, CancellationToken ct);
|
||||
Task<ServiceResult<UserResponse>> GetByIdAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult<UserResponse>> CreateAsync(CreateUserRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<UserResponse>> UpdateAsync(Guid id, UpdateUserRequest request, CancellationToken ct);
|
||||
Task<ServiceResult> AssignRolesAsync(Guid id, AssignRolesRequest request, CancellationToken ct);
|
||||
Task<ServiceResult> AssignSitesAsync(Guid id, AssignSitesRequest request, CancellationToken ct);
|
||||
Task<ServiceResult<ResetPasswordResponse>> ResetPasswordAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult> LockAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult> UnlockAsync(Guid id, CancellationToken ct);
|
||||
Task<ServiceResult> DeleteAsync(Guid id, Guid currentUserId, CancellationToken ct);
|
||||
}
|
||||
Reference in new issue
Block a user