Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.28.2",
"version": "0.30.1",
"commands": [
"dotnet-csharpier"
]
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.28.2">
<PackageReference Include="CSharpier.MsBuild" Version="0.30.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
17 changes: 11 additions & 6 deletions src/Altinn.App.Api/Controllers/ActionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public async Task<ActionResult<UserActionResponse>> Perform(
Instance = instanceGuid.ToString(),
Status = 400,
Title = "Action is missing",
Detail = "Action is missing in the request"
Detail = "Action is missing in the request",
}
);
}
Expand Down Expand Up @@ -134,8 +134,13 @@ public async Task<ActionResult<UserActionResponse>> Perform(
await _appMetadata.GetApplicationMetadata(),
_modelSerialization
);
UserActionContext userActionContext =
new(dataMutator, userId.Value, actionRequest.ButtonId, actionRequest.Metadata, language);
UserActionContext userActionContext = new(
dataMutator,
userId.Value,
actionRequest.ButtonId,
actionRequest.Metadata,
language
);
IUserAction? actionHandler = _userActionService.GetActionHandler(action);
if (actionHandler == null)
{
Expand All @@ -147,7 +152,7 @@ await _appMetadata.GetApplicationMetadata(),
{
Code = "ActionNotFound",
Message = $"Action handler with id {action} not found",
}
},
}
);
}
Expand All @@ -162,13 +167,13 @@ await _appMetadata.GetApplicationMetadata(),
ProcessErrorType.Conflict => 409,
ProcessErrorType.Unauthorized => 401,
ProcessErrorType.BadRequest => 400,
_ => 500
_ => 500,
},
value: new UserActionResponse()
{
Instance = instance,
ClientActions = result.ClientActions,
Error = result.Error
Error = result.Error,
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ namespace Altinn.App.Api.Controllers;
[ApiController]
public class ApplicationSettingsController : ControllerBase
{
private static readonly JsonSerializerOptions _jsonSerializerOptions =
new() { DictionaryKeyPolicy = JsonNamingPolicy.CamelCase };
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
};

private readonly AppSettings _appSettings;
private readonly FrontEndSettings _frontEndSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/Altinn.App.Api/Controllers/AuthenticationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task<IActionResult> KeepAlive()
HttpOnly = true,
Secure = true,
IsEssential = true,
SameSite = SameSiteMode.Lax
SameSite = SameSiteMode.Lax,
};

if (!string.IsNullOrWhiteSpace(token))
Expand Down
32 changes: 16 additions & 16 deletions src/Altinn.App.Api/Controllers/DataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ await GetErrorDetails(
Description = response.Error.Detail,
Code = response.Error.Title,
Severity = ValidationIssueSeverity.Error,
Source = response.Error.Type ?? "DataController"
}
Source = response.Error.Type ?? "DataController",
},
]
)
);
Expand Down Expand Up @@ -640,7 +640,7 @@ public async Task<ActionResult<DataPatchResponse>> PatchFormData(
var request = new DataPatchRequestMultiple()
{
Patches = [new(dataGuid, dataPatchRequest.Patch)],
IgnoredValidators = dataPatchRequest.IgnoredValidators
IgnoredValidators = dataPatchRequest.IgnoredValidators,
};
var response = await PatchFormDataMultiple(org, app, instanceOwnerPartyId, instanceGuid, request, language);

Expand Down Expand Up @@ -725,7 +725,7 @@ public async Task<ActionResult<DataPatchResponseMultiple>> PatchFormDataMultiple
{
Instance = res.Ok.Instance,
NewDataModels = GetNewDataModels(res.Ok.FormDataChanges),
ValidationIssues = res.Ok.ValidationIssues
ValidationIssues = res.Ok.ValidationIssues,
}
);
}
Expand Down Expand Up @@ -1131,7 +1131,7 @@ private ActionResult HandlePlatformHttpException(PlatformHttpException e, string
HttpStatusCode.Forbidden => Forbid(),
HttpStatusCode.NotFound => NotFound(),
HttpStatusCode.Conflict => Conflict(),
_ => ExceptionResponse(e, defaultMessage)
_ => ExceptionResponse(e, defaultMessage),
};
}

Expand All @@ -1153,7 +1153,7 @@ private async Task<
{
Title = "Instance Not Found",
Detail = $"Did not find instance {instanceOwnerPartyId}/{instanceGuid}",
Status = (int)HttpStatusCode.NotFound
Status = (int)HttpStatusCode.NotFound,
};
}

Expand All @@ -1168,7 +1168,7 @@ private async Task<
Title = "Data Element Not Found",
Detail =
$"Did not find data element {dataElementGuid} on instance {instanceOwnerPartyId}/{instanceGuid}",
Status = (int)HttpStatusCode.BadRequest
Status = (int)HttpStatusCode.BadRequest,
};
}

Expand All @@ -1180,7 +1180,7 @@ private async Task<
Title = "Data Type Not Found",
Detail =
$"""Could not find the specified data type: "{dataElement.DataType}" in applicationmetadata.json""",
Status = (int)HttpStatusCode.BadRequest
Status = (int)HttpStatusCode.BadRequest,
};
}

Expand All @@ -1192,7 +1192,7 @@ private async Task<
{
Title = "Instance Not Found",
Detail = e.Message,
Status = (int)e.Response.StatusCode
Status = (int)e.Response.StatusCode,
};
}
}
Expand All @@ -1215,7 +1215,7 @@ IEnumerable<Guid> dataElementGuids
{
Title = "Instance Not Found",
Detail = $"Did not find instance {instanceOwnerPartyId}/{instanceGuid}",
Status = (int)HttpStatusCode.NotFound
Status = (int)HttpStatusCode.NotFound,
};
}

Expand All @@ -1234,7 +1234,7 @@ IEnumerable<Guid> dataElementGuids
Title = "Data Element Not Found",
Detail =
$"Did not find data element {dataElementGuid} on instance {instanceOwnerPartyId}/{instanceGuid}",
Status = (int)HttpStatusCode.NotFound
Status = (int)HttpStatusCode.NotFound,
};
}

Expand All @@ -1246,7 +1246,7 @@ IEnumerable<Guid> dataElementGuids
Title = "Data Type Not Found",
Detail =
$"""Data element {dataElement.Id} requires data type "{dataElement.DataType}", but it was not found in applicationmetadata.json""",
Status = (int)HttpStatusCode.InternalServerError
Status = (int)HttpStatusCode.InternalServerError,
};
}

Expand All @@ -1261,7 +1261,7 @@ IEnumerable<Guid> dataElementGuids
{
Title = "Instance Not Found",
Detail = e.Message,
Status = (int)e.Response.StatusCode
Status = (int)e.Response.StatusCode,
};
}
}
Expand All @@ -1279,7 +1279,7 @@ private async Task<
{
Title = "Instance Not Found",
Detail = $"Did not find instance {instanceOwnerPartyId}/{instanceGuid}",
Status = (int)HttpStatusCode.NotFound
Status = (int)HttpStatusCode.NotFound,
};
}

Expand All @@ -1292,7 +1292,7 @@ private async Task<
{
Title = "Data Type Not Found",
Detail = $"""Could not find the specified data type: "{dataTypeId}" in applicationmetadata.json""",
Status = (int)HttpStatusCode.BadRequest
Status = (int)HttpStatusCode.BadRequest,
};
}

Expand All @@ -1304,7 +1304,7 @@ private async Task<
{
Title = "Instance Not Found",
Detail = e.Message,
Status = (int)e.Response.StatusCode
Status = (int)e.Response.StatusCode,
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Altinn.App.Api/Controllers/DataTagsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ [FromBody] string tag
app,
instanceOwnerPartyId,
instanceGuid,
dataGuid
dataGuid,
};
return CreatedAtAction(nameof(Get), routeValues, tagsList);
}
Expand Down
8 changes: 5 additions & 3 deletions src/Altinn.App.Api/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ namespace Altinn.App.Api.Controllers;
/// </summary>
public class HomeController : Controller
{
private static readonly JsonSerializerOptions _jsonSerializerOptions =
new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

private readonly IAntiforgery _antiforgery;
private readonly PlatformSettings _platformSettings;
Expand Down Expand Up @@ -75,7 +77,7 @@ [FromQuery] bool dontChooseReportee
tokens.RequestToken,
new CookieOptions
{
HttpOnly = false // Make this cookie readable by Javascript.
HttpOnly = false, // Make this cookie readable by Javascript.
}
);
}
Expand Down
51 changes: 24 additions & 27 deletions src/Altinn.App.Api/Controllers/InstancesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@
{
InstanceOwner = new InstanceOwner
{
PartyId = instanceOwnerPartyId.Value.ToString(CultureInfo.InvariantCulture)
}
PartyId = instanceOwnerPartyId.Value.ToString(CultureInfo.InvariantCulture),
},
};
}

Expand Down Expand Up @@ -507,14 +507,13 @@
);
}

Instance instanceTemplate =
new()
{
InstanceOwner = instansiationInstance.InstanceOwner,
VisibleAfter = instansiationInstance.VisibleAfter,
DueBefore = instansiationInstance.DueBefore,
Org = application.Org
};
Instance instanceTemplate = new()
{
InstanceOwner = instansiationInstance.InstanceOwner,
VisibleAfter = instansiationInstance.VisibleAfter,
DueBefore = instansiationInstance.DueBefore,
Org = application.Org,
};

ConditionallySetReadStatus(instanceTemplate);

Expand All @@ -536,7 +535,7 @@
{
Instance = instanceTemplate,
User = User,
Prefill = instansiationInstance.Prefill
Prefill = instansiationInstance.Prefill,
};

processResult = await _processEngine.GenerateProcessStartEvents(request);
Expand Down Expand Up @@ -666,13 +665,12 @@
}

// Multiple properties like Org and AppId will be set by Storage
Instance targetInstance =
new()
{
InstanceOwner = sourceInstance.InstanceOwner,
VisibleAfter = sourceInstance.VisibleAfter,
Status = new() { ReadStatus = ReadStatus.Read }
};
Instance targetInstance = new()
{
InstanceOwner = sourceInstance.InstanceOwner,
VisibleAfter = sourceInstance.VisibleAfter,
Status = new() { ReadStatus = ReadStatus.Read },
};

InstantiationValidationResult? validationResult = await _instantiationValidator.Validate(targetInstance);
if (validationResult != null && !validationResult.Valid)
Expand Down Expand Up @@ -841,14 +839,13 @@
int instanceOwnerPartyId
)
{
Dictionary<string, StringValues> queryParams =
new()
{
{ "appId", $"{org}/{app}" },
{ "instanceOwner.partyId", instanceOwnerPartyId.ToString(CultureInfo.InvariantCulture) },
{ "status.isArchived", "false" },
{ "status.isSoftDeleted", "false" }
};
Dictionary<string, StringValues> queryParams = new()
{
{ "appId", $"{org}/{app}" },
{ "instanceOwner.partyId", instanceOwnerPartyId.ToString(CultureInfo.InvariantCulture) },
{ "status.isArchived", "false" },
{ "status.isSoftDeleted", "false" },
};

List<Instance> activeInstances = await _instanceClient.GetInstances(queryParams);

Expand Down Expand Up @@ -1161,7 +1158,7 @@
{
Title = "Data type not found",
Detail =
$"Data type with id {part.Name} from request part {partIndex} not found in application metadata"
$"Data type with id {part.Name} from request part {partIndex} not found in application metadata",
};
}

Expand Down
6 changes: 3 additions & 3 deletions src/Altinn.App.Api/Controllers/PartiesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public async Task<IActionResult> ValidateInstantiation(string org, string app, [
ValidParties = InstantiationHelper.FilterPartiesByAllowedPartyTypes(
partyList,
partyTypesAllowed
)
),
}
);
}
Expand All @@ -136,12 +136,12 @@ public async Task<IActionResult> ValidateInstantiation(string org, string app, [
{
Valid = false,
Message = "The supplied party is not allowed to instantiate the application",
ValidParties = InstantiationHelper.FilterPartiesByAllowedPartyTypes(partyList, partyTypesAllowed)
ValidParties = InstantiationHelper.FilterPartiesByAllowedPartyTypes(partyList, partyTypesAllowed),
}
);
}

return Ok(new InstantiationValidationResult { Valid = true, });
return Ok(new InstantiationValidationResult { Valid = true });
}

/// <summary>
Expand Down
6 changes: 4 additions & 2 deletions src/Altinn.App.Api/Controllers/PdfController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ namespace Altinn.App.Api.Controllers;
[ApiController]
public class PdfController : ControllerBase
{
private static readonly JsonSerializerOptions _jsonSerializerOptions =
new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

private readonly IInstanceClient _instanceClient;
#pragma warning disable CS0618 // Type or member is obsolete
Expand Down
Loading
Loading