Skip to content

Commit

Permalink
Register IInstanceAndEventsRepository (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinothamar authored Nov 28, 2024
1 parent e739508 commit 9c637c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Storage/Controllers/ProcessController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ public async Task<ActionResult<Instance>> PutInstanceAndEvents(
return NotFound();
}

foreach (InstanceEvent instanceEvent in processStateUpdate.Events ?? [])
{
if (string.IsNullOrWhiteSpace(instanceEvent.InstanceId))
{
instanceEvent.InstanceId = $"{instanceOwnerPartyId}/{instanceGuid}";
}

instanceEvent.Created = instanceEvent.Created?.ToUniversalTime() ?? DateTime.UtcNow;
}

ProcessState processState = processStateUpdate.State;

var (action, taskId) = ActionMapping(processState, existingInstance);
Expand Down
1 change: 1 addition & 0 deletions src/Storage/Repository/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static IServiceCollection AddRepositoriesPostgreSQL(this IServiceCollecti
.AddSingleton<IDataRepository, PgDataRepository>()
.AddSingleton<IInstanceEventRepository, PgInstanceEventRepository>()
.AddSingleton<IInstanceRepository, PgInstanceRepository>()
.AddSingleton<IInstanceAndEventsRepository, PgInstanceAndEventsRepository>()
.AddSingleton<IBlobRepository, BlobRepository>()
.AddSingleton<IA2Repository, PgA2Repository>()
.AddNpgsqlDataSource(connectionString, builder => builder.EnableParameterLogging(logParameters).EnableDynamicJson());
Expand Down

0 comments on commit 9c637c6

Please sign in to comment.