feat(contracts): add API DTOs and request/response contracts

This commit is contained in:
2024-12-17 12:00:00 -05:00
parent 9357cbe026
commit 7a09f8e2f6
20 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
namespace IncidentOps.Contracts.Auth;
public record AuthResponse(string AccessToken, string RefreshToken, ActiveOrgDto ActiveOrg);
public record ActiveOrgDto(Guid Id, string Name, string Slug, string Role);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Auth;
public record LoginRequest(string Email, string Password, Guid? OrgId = null);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Auth;
public record LogoutRequest(string RefreshToken);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Auth;
public record MeResponse(Guid Id, string Email, string DisplayName, ActiveOrgDto ActiveOrg);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Auth;
public record RefreshRequest(string RefreshToken);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Auth;
public record RegisterRequest(string Email, string Password, string DisplayName);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Auth;
public record SwitchOrgRequest(string RefreshToken, Guid OrgId);

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Incidents;
public record CommentRequest(string Content);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Incidents;
public record CreateIncidentRequest(string Title, string? Description);

View File

@@ -0,0 +1,17 @@
namespace IncidentOps.Contracts.Incidents;
public record IncidentDto(
Guid Id,
Guid ServiceId,
string ServiceName,
string Title,
string? Description,
string Status,
int Version,
Guid? AssignedToUserId,
string? AssignedToUserName,
DateTime CreatedAt,
DateTime? AcknowledgedAt,
DateTime? MitigatedAt,
DateTime? ResolvedAt
);

View File

@@ -0,0 +1,10 @@
namespace IncidentOps.Contracts.Incidents;
public record IncidentEventDto(
Guid Id,
string EventType,
Guid? ActorUserId,
string? ActorUserName,
string? Payload,
DateTime CreatedAt
);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Incidents;
public record IncidentListResponse(IReadOnlyList<IncidentDto> Items, string? NextCursor);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Incidents;
public record TransitionRequest(string Action, int ExpectedVersion);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Orgs;
public record CreateNotificationTargetRequest(string Name, string TargetType, string Configuration, bool IsEnabled);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Orgs;
public record NotificationTargetDto(Guid Id, string Name, string TargetType, string Configuration, bool IsEnabled, DateTime CreatedAt);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Orgs;
public record OrgDto(Guid Id, string Name, string Slug, string Role);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Orgs;
public record OrgMemberDto(Guid Id, Guid UserId, string Email, string DisplayName, string Role, DateTime JoinedAt);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Services;
public record CreateServiceRequest(string Name, string Slug, string? Description);

View File

@@ -0,0 +1,3 @@
namespace IncidentOps.Contracts.Services;
public record ServiceDto(Guid Id, string Name, string Slug, string? Description, DateTime CreatedAt);