feat(domain): add domain entities and enums

This commit is contained in:
2024-12-16 12:00:00 -05:00
parent 49ec9cd997
commit 9357cbe026
14 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using IncidentOps.Domain.Enums;
namespace IncidentOps.Domain.Entities;
public class Incident
{
public Guid Id { get; set; }
public Guid OrgId { get; set; }
public Guid ServiceId { get; set; }
public required string Title { get; set; }
public string? Description { get; set; }
public IncidentStatus Status { get; set; }
public int Version { get; set; }
public Guid? AssignedToUserId { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? AcknowledgedAt { get; set; }
public DateTime? MitigatedAt { get; set; }
public DateTime? ResolvedAt { get; set; }
}

View File

@@ -0,0 +1,13 @@
using IncidentOps.Domain.Enums;
namespace IncidentOps.Domain.Entities;
public class IncidentEvent
{
public Guid Id { get; set; }
public Guid IncidentId { get; set; }
public IncidentEventType EventType { get; set; }
public Guid? ActorUserId { get; set; }
public string? Payload { get; set; }
public DateTime CreatedAt { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace IncidentOps.Domain.Entities;
public class NotificationAttempt
{
public Guid Id { get; set; }
public Guid IncidentId { get; set; }
public Guid TargetId { get; set; }
public bool Success { get; set; }
public string? ErrorMessage { get; set; }
public int AttemptNumber { get; set; }
public DateTime CreatedAt { get; set; }
}

View File

@@ -0,0 +1,15 @@
using IncidentOps.Domain.Enums;
namespace IncidentOps.Domain.Entities;
public class NotificationTarget
{
public Guid Id { get; set; }
public Guid OrgId { get; set; }
public required string Name { get; set; }
public NotificationTargetType TargetType { get; set; }
public required string Configuration { get; set; }
public bool IsEnabled { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace IncidentOps.Domain.Entities;
public class Org
{
public Guid Id { get; set; }
public required string Name { get; set; }
public required string Slug { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}

View File

@@ -0,0 +1,13 @@
using IncidentOps.Domain.Enums;
namespace IncidentOps.Domain.Entities;
public class OrgMember
{
public Guid Id { get; set; }
public Guid OrgId { get; set; }
public Guid UserId { get; set; }
public OrgRole Role { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace IncidentOps.Domain.Entities;
public class RefreshToken
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public required string TokenHash { get; set; }
public Guid ActiveOrgId { get; set; }
public DateTime ExpiresAt { get; set; }
public DateTime? RevokedAt { get; set; }
public DateTime CreatedAt { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace IncidentOps.Domain.Entities;
public class Service
{
public Guid Id { get; set; }
public Guid OrgId { get; set; }
public required string Name { get; set; }
public required string Slug { get; set; }
public string? Description { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}

View File

@@ -0,0 +1,11 @@
namespace IncidentOps.Domain.Entities;
public class User
{
public Guid Id { get; set; }
public required string Email { get; set; }
public required string PasswordHash { get; set; }
public required string DisplayName { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}

View File

@@ -0,0 +1,13 @@
namespace IncidentOps.Domain.Enums;
public enum IncidentEventType
{
Created,
Acknowledged,
Mitigated,
Resolved,
Comment,
NotificationSent,
NotificationFailed,
EscalationTriggered
}

View File

@@ -0,0 +1,9 @@
namespace IncidentOps.Domain.Enums;
public enum IncidentStatus
{
Triggered,
Acknowledged,
Mitigated,
Resolved
}

View File

@@ -0,0 +1,8 @@
namespace IncidentOps.Domain.Enums;
public enum NotificationTargetType
{
Webhook,
Email,
Slack
}

View File

@@ -0,0 +1,8 @@
namespace IncidentOps.Domain.Enums;
public enum OrgRole
{
Viewer,
Member,
Admin
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\IncidentOps.Contracts\IncidentOps.Contracts.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>