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
5 changes: 2 additions & 3 deletions backend/FwLite/FwDataMiniLcmBridge/Api/FwDataMiniLcmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,17 @@ private ComplexFormType ToComplexFormType(ICmPossibility t)

public Task<ComplexFormType> CreateComplexFormType(ComplexFormType complexFormType)
{
if (complexFormType.Id != default) throw new InvalidOperationException("Complex form type id must be empty");
if (complexFormType.Id == default) complexFormType.Id = Guid.NewGuid();
UndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW("Create complex form type",
"Remove complex form type",
Cache.ActionHandlerAccessor,
() =>
{
var lexComplexFormType = Cache.ServiceLocator
.GetInstance<ILexEntryTypeFactory>()
.Create();
.Create(complexFormType.Id);
ComplexFormTypes.PossibilitiesOS.Add(lexComplexFormType);
UpdateLcmMultiString(lexComplexFormType.Name, complexFormType.Name);
complexFormType.Id = lexComplexFormType.Guid;
});
return Task.FromResult(ToComplexFormType(ComplexFormTypes.PossibilitiesOS.Single(c => c.Guid == complexFormType.Id)));
}
Expand Down
4 changes: 2 additions & 2 deletions backend/FwLite/FwDataMiniLcmBridge/FwDataMiniLcmBridge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="SIL.Core" Version="14.2.0-beta0009" />
<PackageReference Include="SIL.Core" Version="14.2.0-beta0022" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />
<PackageReference Include="SIL.LCModel" Version="11.0.0-beta0100 " />
<PackageReference Include="SIL.LCModel" Version="11.0.0-beta0111" />
<PackageReference Include="structuremap.patched" Version="4.7.3" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/LcmCrdt/CrdtMiniLcmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public IAsyncEnumerable<ComplexFormType> GetComplexFormTypes()
return ComplexFormTypes.AsAsyncEnumerable();
}

public async Task<ComplexFormType> CreateComplexFormType(MiniLcm.Models.ComplexFormType complexFormType)
public async Task<ComplexFormType> CreateComplexFormType(ComplexFormType complexFormType)
{
if (complexFormType.Id == default) complexFormType.Id = Guid.NewGuid();
await dataModel.AddChange(ClientId, new CreateComplexFormType(complexFormType.Id, complexFormType.Name));
Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/LocalWebApp/LocalWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="icu.net" Version="2.10.1-beta.5" GeneratePathProperty="true" />
<PackageReference Include="icu.net" Version="3.0.0-beta.297" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.10" />
Expand Down
9 changes: 9 additions & 0 deletions backend/FwLite/MiniLcm.Tests/ComplexFormComponentTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ public async Task CreateComplexFormComponent_CanCreateMultipleComponentSenses()
component2.ComponentEntryId.Should().Be(_componentEntryId);
component2.ComponentSenseId.Should().Be(_componentSenseId2);
}

[Fact]
public async Task CreateComplexFormType_Works()
{
var complexFormType = new ComplexFormType() { Id = Guid.NewGuid(), Name = new() { { "en", "test" } } };
await Api.CreateComplexFormType(complexFormType);
var types = await Api.GetComplexFormTypes().ToArrayAsync();
types.Should().ContainSingle(t => t.Id == complexFormType.Id);
}
}