Skip to content

Commit

Permalink
Merge branch 'main' into 13689-submitting-a-valid-layoutset-name-resu…
Browse files Browse the repository at this point in the history
…lts-in-an-error
  • Loading branch information
standeren authored Dec 30, 2024
2 parents ed9d076 + 3db9af6 commit 914a426
Show file tree
Hide file tree
Showing 121 changed files with 2,143 additions and 1,019 deletions.
16 changes: 12 additions & 4 deletions backend/packagegroups/NuGet.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
<PackageReference Update="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Update="Microsoft.Azure.Security.KeyVault.Secrets" Version="4.5.0" />
<PackageReference Update="Microsoft.Azure.Services.AppAuthentication" Version="1.6.2" />
<PackageReference Update="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.24" />
<PackageReference Update="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0" />
Expand All @@ -42,6 +41,15 @@
<PackageReference Update="DotNetEnv" Version="3.1.1" />
<PackageReference Update="NuGet.Versioning" Version="6.12.1" />
<PackageReference Update="DistributedLock.Postgres" Version="1.2.1" />
<PackageReference Include="System.Text.Json" Version="[9.0.0]" />
<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="[4.8.0, 4.12.0)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="[4.12.0]" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="[4.12.0]" />
<PackageReference Update="Azure.Security.KeyVault.Secrets" Version="[4.7.0]" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Net.Http" Version="[4.3.4]" />
<PackageReference Include="System.Text.RegularExpressions" Version="[4.3.1]" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
</ItemGroup>

<ItemGroup Label="Packages used for testing">
Expand All @@ -56,13 +64,13 @@
<PackageReference Update="Basic.Reference.Assemblies" Version="1.7.8" />
<PackageReference Update="Fare" Version="2.2.1" />
<PackageReference Update="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="4.12.0" />
<PackageReference Update="Testcontainers" Version="3.10.0" />
<PackageReference Update="Testcontainers.PostgreSql" Version="3.10.0" />
<PackageReference Update="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="9.0.0" />
<PackageReference Update="WireMock.Net" Version="1.6.9" />
<PackageReference Update="WireMock.Net" Version="1.6.10" />
<PackageReference Update="DistributedLock.FileSystem" Version="1.0.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace Altinn.Studio.DataModeling.Converter.Csharp
{
Expand All @@ -23,11 +22,5 @@ public CsharpGenerationException(string message) : base(message)
public CsharpGenerationException(string message, Exception innerException) : base(message, innerException)
{
}

/// <inheritdoc/>
protected CsharpGenerationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace Altinn.Studio.DataModeling.Converter.Json
{
Expand Down Expand Up @@ -29,12 +28,5 @@ public JsonSchemaConvertException(string message) : base(message)
public JsonSchemaConvertException(string message, Exception innerException) : base(message, innerException)
{
}

/// <summary>
/// <inheritdoc/>
/// </summary>
protected JsonSchemaConvertException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace Altinn.Studio.DataModeling.Converter.Metadata
{
Expand All @@ -23,10 +22,5 @@ public MetamodelConvertException(string message) : base(message)
public MetamodelConvertException(string message, Exception innerException) : base(message, innerException)
{
}

/// <inheritdoc/>
protected MetamodelConvertException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace Altinn.Studio.DataModeling.Converter.Xml
{
Expand Down Expand Up @@ -29,12 +28,5 @@ public XmlSchemaConvertException(string message) : base(message)
public XmlSchemaConvertException(string message, Exception innerException) : base(message, innerException)
{
}

/// <summary>
/// <inheritdoc/>
/// </summary>
protected XmlSchemaConvertException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
1 change: 1 addition & 0 deletions backend/src/DataModeling/DataModeling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<AssemblyName>Altinn.Studio.DataModeling</AssemblyName>
<LangVersion>latest</LangVersion>
<RootNamespace>Altinn.Studio.DataModeling</RootNamespace>
<Version>1.0.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class ApplicationMetadataController : ControllerBase
/// Initializes a new instance of the <see cref="ApplicationMetadataController"/> class.
/// </summary>
/// <param name="applicationMetadataService">The application metadata service</param>
/// <param name="userRequestsSynchronizationService">The user requests synchronization service</param>
public ApplicationMetadataController(IApplicationMetadataService applicationMetadataService)
{
_applicationMetadataService = applicationMetadataService;
Expand Down
30 changes: 30 additions & 0 deletions backend/src/Designer/Controllers/DatamodelsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Text.Json.Nodes;
using System.Threading;
using System.Threading.Tasks;
using Altinn.Platform.Storage.Interface.Models;
using Altinn.Studio.DataModeling.Validator.Json;
using Altinn.Studio.Designer.Filters;
using Altinn.Studio.Designer.Helpers;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class DatamodelsController : ControllerBase
/// </summary>
/// <param name="schemaModelService">Interface for working with models.</param>
/// <param name="jsonSchemaValidator">An <see cref="IJsonSchemaValidator"/>.</param>
/// <param name="modelNameValidator">Interface for validating that the model name does not already belong to a data type</param>
public DatamodelsController(ISchemaModelService schemaModelService, IJsonSchemaValidator jsonSchemaValidator, IModelNameValidator modelNameValidator)
{
_schemaModelService = schemaModelService;
Expand Down Expand Up @@ -248,6 +250,34 @@ public async Task<IActionResult> UseXsdFromRepo(string org, string repository, s
}
}

/// <summary>
/// Gets the dataType for a given data model.
/// </summary>
[HttpGet("datamodel/{modelName}/dataType")]
[UseSystemTextJson]
public async Task<ActionResult<DataType>> GetModelDataType(string org, string repository, string modelName)
{
DataType dataType = await _schemaModelService.GetModelDataType(org, repository, modelName);
return Ok(dataType);
}

/// <summary>
/// Updates the dataType for a given data model.
/// </summary>
[HttpPut("datamodel/{modelName}/dataType")]
[UseSystemTextJson]
public async Task<ActionResult> SetModelDataType(string org, string repository, string modelName, [FromBody] DataType dataType)
{
if (!Equals(modelName, dataType.Id))
{
return BadRequest("Model name in path and request body does not match");
}

await _schemaModelService.SetModelDataType(org, repository, modelName, dataType);
DataType updatedDataType = await _schemaModelService.GetModelDataType(org, repository, modelName);
return Ok(updatedDataType);
}

private static string GetFileNameFromUploadedFile(IFormFile thefile)
{
return ContentDispositionHeaderValue.Parse(new StringSegment(thefile.ContentDisposition)).FileName.ToString();
Expand Down
20 changes: 20 additions & 0 deletions backend/src/Designer/Controllers/OptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading.Tasks;
using Altinn.Studio.Designer.Helpers;
using Altinn.Studio.Designer.Models;
using Altinn.Studio.Designer.Models.Dto;
using Altinn.Studio.Designer.Services.Interfaces;
using LibGit2Sharp;
using Microsoft.AspNetCore.Authorization;
Expand Down Expand Up @@ -107,6 +108,25 @@ public async Task<ActionResult<List<Option>>> GetOptionsList(string org, string
}
}

/// <summary>
/// Gets all usages of all optionListIds in the layouts as <see cref="RefToOptionListSpecifier"/>.
/// </summary>
/// <param name="org">Unique identifier of the organisation responsible for the app.</param>
/// <param name="repo">Application identifier which is unique within an organisation.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that observes if operation is cancelled.</param>
[HttpGet]
[Produces("application/json")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Route("usage")]
public async Task<ActionResult<List<RefToOptionListSpecifier>>> GetOptionListsReferences(string org, string repo, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext);

List<RefToOptionListSpecifier> optionListReferences = await _optionsService.GetAllOptionListReferences(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repo, developer), cancellationToken);
return Ok(optionListReferences);
}

/// <summary>
/// Creates or overwrites an options list.
/// </summary>
Expand Down
Loading

0 comments on commit 914a426

Please sign in to comment.