Initial import

This commit is contained in:
Stein Helge Riise
2025-11-17 08:32:46 +01:00
commit ede31fbb7e
129 changed files with 9514 additions and 0 deletions
@@ -0,0 +1,30 @@
namespace MinAttest.Domain.Entities;
public class Attest
{
public Guid Id { get; set; }
public Guid PersonId { get; set; }
public Person Person { get; set; } = null!;
public Guid? EmployerId { get; set; }
public Employer? Employer { get; set; }
public string Title { get; set; } = string.Empty;
public DateOnly From { get; set; }
public DateOnly To { get; set; }
public string? Summary { get; set; }
public string BlobPath { get; set; } = string.Empty;
public string? BlobHash { get; set; }
// Temporary in-DB storage (to be replaced by Azure Blob)
public byte[]? Content { get; set; }
public string? ContentType { get; set; }
public long? ContentLength { get; set; }
public AttestStatus Status { get; set; } = AttestStatus.Unverified;
public DateTimeOffset IssuedAt { get; set; } = DateTimeOffset.UtcNow;
public string? IssuedBy { get; set; }
public ICollection<ShareLink> ShareLinks { get; set; } = [];
}
@@ -0,0 +1,13 @@
namespace MinAttest.Domain.Entities;
public class AuditLog
{
public Guid Id { get; set; }
public ActorType ActorType { get; set; }
public Guid? ActorId { get; set; }
public string Action { get; set; } = string.Empty;
public string TargetType { get; set; } = string.Empty;
public Guid TargetId { get; set; }
public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow;
public string? Ip { get; set; }
}
@@ -0,0 +1,11 @@
namespace MinAttest.Domain.Entities;
public class Employer
{
public Guid Id { get; set; }
public string OrgNumber { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public ICollection<Attest> Attests { get; set; } = [];
public ICollection<EmployerUser> Users { get; set; } = [];
}
@@ -0,0 +1,17 @@
namespace MinAttest.Domain.Entities;
public class EmployerUser
{
public Guid Id { get; set; }
public Guid EmployerId { get; set; }
public Employer Employer { get; set; } = null!;
// Entra ID object id of the user
public string ExternalObjectId { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string? Name { get; set; }
public EmployerUserRole Role { get; set; } = EmployerUserRole.Issuer;
}
@@ -0,0 +1,21 @@
namespace MinAttest.Domain.Entities;
public enum AttestStatus
{
Issued = 1,
Unverified = 2,
Revoked = 3
}
public enum ActorType
{
Person = 1,
Employer = 2,
Verifier = 3
}
public enum EmployerUserRole
{
Issuer = 1,
Admin = 2
}
@@ -0,0 +1,12 @@
namespace MinAttest.Domain.Entities;
public class Person
{
public Guid Id { get; set; }
public string NationalIdHash { get; set; } = null!;
public string? NationalIdEncrypted { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public ICollection<Attest> Attests { get; set; } = [];
}
@@ -0,0 +1,13 @@
namespace MinAttest.Domain.Entities;
public class ShareLink
{
public Guid Id { get; set; }
public Guid AttestId { get; set; }
public Attest Attest { get; set; } = null!;
public string Code { get; set; } = string.Empty;
public DateTimeOffset ExpiresAt { get; set; }
public DateTimeOffset? RevokedAt { get; set; }
public bool OneTime { get; set; }
}
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>