sprints work

This commit is contained in:
master
2026-01-11 11:19:40 +02:00
parent f6ef1ef337
commit 582a41d7a9
72 changed files with 2680 additions and 390 deletions

View File

@@ -66,12 +66,12 @@ public sealed class Integration
/// <summary>
/// UTC timestamp when the integration was created.
/// </summary>
public DateTimeOffset CreatedAt { get; init; } = DateTimeOffset.UtcNow;
public required DateTimeOffset CreatedAt { get; init; }
/// <summary>
/// UTC timestamp when the integration was last updated.
/// </summary>
public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
public required DateTimeOffset UpdatedAt { get; set; }
/// <summary>
/// User or system that created this integration.

View File

@@ -10,10 +10,12 @@ namespace StellaOps.Integrations.Persistence;
public sealed class PostgresIntegrationRepository : IIntegrationRepository
{
private readonly IntegrationDbContext _context;
private readonly TimeProvider _timeProvider;
public PostgresIntegrationRepository(IntegrationDbContext context)
public PostgresIntegrationRepository(IntegrationDbContext context, TimeProvider? timeProvider = null)
{
_context = context;
_timeProvider = timeProvider ?? TimeProvider.System;
}
public async Task<Integration?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default)
@@ -93,7 +95,7 @@ public sealed class PostgresIntegrationRepository : IIntegrationRepository
{
entity.IsDeleted = true;
entity.Status = IntegrationStatus.Archived;
entity.UpdatedAt = DateTimeOffset.UtcNow;
entity.UpdatedAt = _timeProvider.GetUtcNow();
await _context.SaveChangesAsync(cancellationToken);
}
}