sprints work
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user