Skip to content

Commit

Permalink
refactor: add IDataTypeContainerService to IDataTypeOrganiseAction (b…
Browse files Browse the repository at this point in the history
…reaking)
  • Loading branch information
jcdcdev committed Oct 17, 2024
1 parent cbf820c commit 610228d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ namespace Umbraco.Community.BackOfficeOrganiser.Organisers.DataTypes;
public class DataTypeOrganiser(
ILogger<DataTypeOrganiser> logger,
IDataTypeService dataTypeService,
IDataTypeContainerService dataTypeContainerService,
DataTypeOrganiseActionCollection organiseActions)
: BackOfficeOrganiserBase<IDataType>(logger)
{
public override async Task OrganiseAsync(IDataType dataType)
{
var organiser = organiseActions.FirstOrDefault(x => x.CanMove(dataType, dataTypeService));
var organiser = organiseActions.FirstOrDefault(x => x.CanMove(dataType, dataTypeService, dataTypeContainerService));
if (organiser != null)
{
await organiser.MoveAsync(dataType, dataTypeService);
await organiser.MoveAsync(dataType, dataTypeService, dataTypeContainerService);
}
}

protected override async Task<IEnumerable<IDataType>> GetAllAsync() => await dataTypeService.GetAllAsync();

protected override void PostOrganiseAll()
{
dataTypeService.DeleteAllEmptyContainers();
dataTypeContainerService.DeleteAllEmptyContainers();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace Umbraco.Community.BackOfficeOrganiser.Organisers.DataTypes;

public interface IDataTypeOrganiseAction
{
public bool CanMove(IDataType dataType, IDataTypeService dataTypeService);
public Task MoveAsync(IDataType dataType, IDataTypeService dataTypeService);
public bool CanMove(IDataType dataType, IDataTypeService dataTypeService, IDataTypeContainerService dataTypeContainerService);
public Task MoveAsync(IDataType dataType, IDataTypeService dataTypeService, IDataTypeContainerService dataTypeContainerService);
}

0 comments on commit 610228d

Please sign in to comment.