Skip to content

Commit

Permalink
Move setting of instance ID to client
Browse files Browse the repository at this point in the history
  • Loading branch information
martinothamar committed Dec 9, 2024
1 parent 5bc79a4 commit f915e07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/Altinn.App.Api/Controllers/InstancesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,6 @@ public async Task<ActionResult<Instance>> Post(

// create the instance
instance = await _instanceClient.CreateInstance(org, app, instanceTemplate);
foreach (var instanceEvent in result.ProcessStateChange?.Events ?? [])
{
instanceEvent.InstanceId = instance.Id;
}
}
catch (Exception exception)
{
Expand Down Expand Up @@ -570,10 +566,6 @@ [FromBody] InstansiationInstance instansiationInstance
}

instance = await _instanceClient.CreateInstance(org, app, instanceTemplate);
foreach (var instanceEvent in processResult.ProcessStateChange?.Events ?? [])
{
instanceEvent.InstanceId = instance.Id;
}

if (isCopyRequest && source is not null)
{
Expand Down Expand Up @@ -691,10 +683,6 @@ [FromRoute] Guid instanceGuid
ProcessChangeResult startResult = await _processEngine.GenerateProcessStartEvents(processStartRequest);

targetInstance = await _instanceClient.CreateInstance(org, app, targetInstance);
foreach (var instanceEvent in startResult.ProcessStateChange?.Events ?? [])
{
instanceEvent.InstanceId = targetInstance.Id;
}

await CopyDataFromSourceInstance(application, targetInstance, sourceInstance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ public async Task<Instance> UpdateProcessAndEvents(Instance instance, List<Insta
using var activity = _telemetry?.StartUpdateProcessActivity(instance, events.Count);
ProcessState processState = instance.Process;

foreach (var instanceEvent in events)
instanceEvent.InstanceId = instance.Id;

string apiUrl = $"instances/{instance.Id}/process/instanceandevents";
string token = _userTokenProvider.GetUserToken();

Expand Down

0 comments on commit f915e07

Please sign in to comment.