refactor: Clean Architecture mit Repository Pattern, Controllern und DTOs
- 15 Controller-Klassen ersetzen Minimal APIs in Program.cs - Repository Pattern mit Interfaces + Implementierungen (Project, Task, Activity, User) - AuthService verwendet jetzt IUserRepository statt direktem DbContext-Zugriff - SecurityHeadersMiddleware als eigenständige Middleware-Klasse - PathSecurityHelper als gemeinsamer Helper für Pfadvalidierung - DTOs in eigenem Namespace Nexus.Api.DTOs - EF-Entities in Nexus.Api.Data (vorher Nexus.Api.Domain) - Program.cs auf DI-Registrierung + Middleware reduziert - Alle 43 Endpoints unverändert erhalten - Build + 3/3 Tests erfolgreich
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Nexus.Api.DTOs;
|
||||
|
||||
public sealed record LoginRequest
|
||||
{
|
||||
[Required, EmailAddress, MaxLength(120)]
|
||||
public string Email { get; init; } = string.Empty;
|
||||
|
||||
[Required, MinLength(10), MaxLength(200)]
|
||||
public string Password { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed record AuthResponse
|
||||
{
|
||||
public string AccessToken { get; init; } = string.Empty;
|
||||
public DateTimeOffset ExpiresAt { get; init; }
|
||||
public UserInfo User { get; init; } = new();
|
||||
}
|
||||
|
||||
public sealed record UserInfo
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public string Email { get; init; } = string.Empty;
|
||||
public string DisplayName { get; init; } = string.Empty;
|
||||
public string Role { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed record UpdateProfileRequest
|
||||
{
|
||||
[MaxLength(100)]
|
||||
public string? DisplayName { get; init; }
|
||||
}
|
||||
|
||||
public sealed record ChangePasswordRequest
|
||||
{
|
||||
[Required, MinLength(10), MaxLength(200)]
|
||||
public string CurrentPassword { get; init; } = string.Empty;
|
||||
|
||||
[Required, MinLength(10), MaxLength(200)]
|
||||
public string NewPassword { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace Nexus.Api.DTOs;
|
||||
|
||||
public sealed record CreateProjectRequest(string Name, string? Description);
|
||||
public sealed record CreateTaskRequest(string Title, string? Priority, Guid? ProjectId);
|
||||
public sealed record UpdateTaskStateRequest(string State);
|
||||
public sealed record ChatRequest(string Message, string? ConversationId, string? AgentId);
|
||||
|
||||
public sealed record UpdateProjectRequest(string? Name, string? Description, string? Status);
|
||||
public sealed record UpdateTaskRequest(string? Title, string? Priority, Guid? ProjectId);
|
||||
|
||||
public sealed record AgentCommandRequest(string Message);
|
||||
|
||||
public sealed record SaveConfigRequest(string Content);
|
||||
|
||||
public sealed record AgentListResponse(
|
||||
string Id,
|
||||
string Name,
|
||||
string Role,
|
||||
string Model,
|
||||
string Status,
|
||||
DateTimeOffset? LastSeen,
|
||||
string? Workspace,
|
||||
string? Description
|
||||
);
|
||||
|
||||
public sealed record AgentDetailResponse(
|
||||
string Id,
|
||||
string Name,
|
||||
string Role,
|
||||
string Model,
|
||||
string Status,
|
||||
DateTimeOffset? LastSeen,
|
||||
string? Workspace,
|
||||
string? AgentDir,
|
||||
string? Description,
|
||||
IReadOnlyList<string>? SubAgents,
|
||||
string? IdentityName
|
||||
);
|
||||
|
||||
public sealed record AgentCommandResponse(
|
||||
string Runtime,
|
||||
string AgentId,
|
||||
string ConversationId,
|
||||
string Content
|
||||
);
|
||||
|
||||
public sealed record CronJobEntry(string Id, string Name, string Schedule, string LastRun, string NextRun, string Status);
|
||||
public sealed record UpcomingCronEntry(string Id, string Name, string NextRun, string Schedule);
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Nexus.Api.DTOs;
|
||||
|
||||
public sealed record ProjectHealthDto(
|
||||
int Online,
|
||||
int Offline,
|
||||
int Degraded,
|
||||
int Unknown
|
||||
);
|
||||
|
||||
public sealed record IncidentInfoDto(
|
||||
Guid? TaskId,
|
||||
string? Title,
|
||||
DateTimeOffset? Since
|
||||
);
|
||||
Reference in New Issue
Block a user