Skip to content

Commit

Permalink
dotnet format run
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrch committed Jul 22, 2024
1 parent 45d664a commit ea5b2a6
Show file tree
Hide file tree
Showing 29 changed files with 143 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class MigrateCustomTablesHandler(
BulkDataCopyService bulkDataCopyService,
IEntityMapper<ICmsClass, DataClassInfo> dataClassMapper,
PrimaryKeyMappingContext primaryKeyMappingContext
// ReusableSchemaService reusableSchemaService
// ReusableSchemaService reusableSchemaService
)
: IRequestHandler<MigrateCustomTablesCommand, CommandResult>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ public async Task<CommandResult> Handle(MigratePagesCommand request, Cancellatio
webPageItemInfo = wp;
break;
}

default:
break;
}
}

Expand Down Expand Up @@ -397,6 +400,9 @@ private async Task MigratePageUrlPaths(Guid webPageItemGuid, int webPageItemId,

break;
}

default:
break;
}
}
}
Expand Down Expand Up @@ -465,6 +471,9 @@ private async Task MigratePageUrlPaths(Guid webPageItemGuid, int webPageItemId,

break;
}

default:
break;
}
}
}
Expand Down Expand Up @@ -526,6 +535,9 @@ private async Task MigratePageUrlPaths(Guid webPageItemGuid, int webPageItemId,

break;
}

default:
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public static void DeferredPatchProperties(JObject propertyContainer, TreePathCo

break;
}

default:
break;
}
}
}
Expand Down
10 changes: 2 additions & 8 deletions KVA/Migration.Toolkit.Source/Helpers/Printer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,13 @@ public static string GetEntityIdentityPrint<T>(T model, bool printType = true)
{
string currentTypeName = ReflectionHelper<T>.CurrentType.Name;

string Fallback(object obj)
{
return printType
string Fallback(object obj) => printType
? $"{currentTypeName}({SerializationHelper.SerializeOnlyNonComplexProperties(obj)})"
: $"{SerializationHelper.SerializeOnlyNonComplexProperties(obj)}";
}

string FormatModel(string inner)
{
return printType
string FormatModel(string inner) => printType
? $"{currentTypeName}({inner})"
: $"{inner}";
}

return model switch
{
Expand Down
18 changes: 12 additions & 6 deletions KVA/Migration.Toolkit.Source/Mappers/CmsClassMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ protected override DataClassInfo MapInternal(ICmsClass source, DataClassInfo tar
{
break;
}

default:
break;
}

switch (source)
Expand All @@ -143,12 +146,12 @@ protected override DataClassInfo MapInternal(ICmsClass source, DataClassInfo tar

// Target Form,null
case
{
ClassIsDocumentType: false,
ClassIsCoupledClass: true,
ClassIsForm: true
// ClassIsPage: false
}
{
ClassIsDocumentType: false,
ClassIsCoupledClass: true,
ClassIsForm: true
// ClassIsPage: false
}
:
{
target.ClassType = ClassType.FORM;
Expand Down Expand Up @@ -189,6 +192,9 @@ protected override DataClassInfo MapInternal(ICmsClass source, DataClassInfo tar
target = PatchDataClassInfo(target, out string? oldPrimaryKeyName, out string? documentNameField);
break;
}

default:
break;
}

return target;
Expand Down
6 changes: 6 additions & 0 deletions KVA/Migration.Toolkit.Source/Mappers/CmsFormMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ protected override BizFormInfo MapInternal(ICmsForm source, BizFormInfo target,
target.FormBuilderLayout = s.FormBuilderLayout;
break;
}

default:
break;
}

if (mappingHelper.TranslateRequiredId<ICmsClass>(c => c.ClassID, source.FormClassID, out int formClassId))
Expand Down Expand Up @@ -112,6 +115,9 @@ protected override CmsForm MapInternal(ICmsForm source, CmsForm target, bool new
target.FormBuilderLayout = s.FormBuilderLayout;
break;
}

default:
break;
}

// TODO tk: 2022-05-20 new deduce: target.FormAfterSubmitMode = source.FormAfterSubmitMode;
Expand Down
17 changes: 13 additions & 4 deletions KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source

DateTime? scheduledPublishWhen = null;
DateTime? scheduleUnpublishWhen = null;

if (cmsDocument.DocumentPublishFrom is { } publishFrom)
{
var now = Service.Resolve<IDateTimeNowService>().GetDateTimeNow();
if (publishFrom > now)
{
versionStatus = VersionStatus.Unpublished;
versionStatus = VersionStatus.Unpublished;
}
else
{
Expand All @@ -155,7 +155,7 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source
var now = Service.Resolve<IDateTimeNowService>().GetDateTimeNow();
if (publishTo < now)
{
versionStatus = VersionStatus.Unpublished;
versionStatus = VersionStatus.Unpublished;
}
else
{
Expand Down Expand Up @@ -183,6 +183,9 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source
contentItemCommonDataPageTemplateConfiguration = doc.DocumentPageTemplateConfiguration;
break;
}

default:
break;
}

PatchJsonDefinitions(source.CmsTree.NodeSiteID, ref contentItemCommonDataPageTemplateConfiguration, ref contentItemCommonDataPageBuilderWidgets, out bool ndp);
Expand Down Expand Up @@ -308,7 +311,7 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source
ContentItemLanguageMetadataHasImageAsset = false,
ContentItemLanguageMetadataContentLanguageGuid = languageGuid, // DocumentCulture -> language entity needs to be created and its ID used here
ContentItemLanguageMetadataScheduledPublishWhen = scheduledPublishWhen,
ContentItemLanguageMetadataScheduledUnpublishWhen = scheduleUnpublishWhen
ContentItemLanguageMetadataScheduledUnpublishWhen = scheduleUnpublishWhen
};
yield return languageMetadataInfo;
}
Expand Down Expand Up @@ -650,6 +653,9 @@ ICmsClass nodeClass

break;
}

default:
break;
}
}
else
Expand Down Expand Up @@ -848,6 +854,9 @@ private void WalkProperties(int siteId, JObject properties, List<EditingFormCont
logger.LogTrace("Value migrated from {Old} model to {New} model", oldFormComponent, newFormComponent);
break;
}

default:
break;
}
}
else if (FieldMappingInstance.BuiltInModel.SupportedInKxpLegacyMode.Contains(editingFcm.FormComponentIdentifier))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ private void WalkProperties(int siteId, JObject properties, List<EditingFormCont
// TODO tomas.krch 2024-03-27: implement!
break;
}

default:
break;
}
}
else if (FieldMappingInstance.BuiltInModel.SupportedInKxpLegacyMode.Contains(editingFcm.FormComponentIdentifier))
Expand Down
5 changes: 1 addition & 4 deletions Migration.Toolkit.CLI/ConfigurationValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ public static IEnumerable<ValidationMessage> GetValidationErrors(IConfigurationR
var customMigrationModel = optInFeatures?.GetValue<CustomMigrationModel>(ConfigurationNames.CustomMigration);
if (customMigrationModel is { FieldMigrations.Length: > 0 })
{
static ValidationMessage Required(int item, string fieldName)
{
return new ValidationMessage(
static ValidationMessage Required(int item, string fieldName) => new ValidationMessage(
ValidationMessageType.Error,
$"Custom DataType migration at index [{item}] is missing value '{fieldName}', supply value or remove whole DataType migration."
);
}

var fieldMigrations = customMigrationModel.FieldMigrations;

Expand Down
2 changes: 2 additions & 0 deletions Migration.Toolkit.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
Console.WriteLine();
}

break;
default:
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions Migration.Toolkit.Common/SemanticVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public static bool TryParse(string? s, [NotNullWhen(true)] out SemanticVersion?
semVer = new SemanticVersion(major, minor, hotfix);
return true;
}

default:
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public bool CheckForTableColumnsDifferences(string tableName, Dictionary<string,
logger.LogError("Table {Table} pairing source({SourceColumnName}) <> target({TargetColumnName}) has failed", tableName, result?.A, result?.B);
anyFailedColumnCheck = true;
break;
default:
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
.WithData(currentRow));
return ValueInterceptorResult.SkipRow;
}

default:
break;
}
}

Expand All @@ -210,6 +213,9 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
.WithData(currentRow));
return ValueInterceptorResult.SkipRow;
}

default:
break;
}
}

Expand All @@ -225,6 +231,9 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
.WithData(currentRow));
return ValueInterceptorResult.SkipRow;
}

default:
break;
}
}

Expand Down Expand Up @@ -333,6 +342,9 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin
return ValueInterceptorResult.SkipRow;
}
}

default:
break;
}
}

Expand Down
12 changes: 3 additions & 9 deletions Migration.Toolkit.Core.K11/Helpers/Printer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,13 @@ public static string GetEntityIdentityPrint<T>(T model, bool printType = true)
{
string currentTypeName = ReflectionHelper<T>.CurrentType.Name;

string Fallback(object obj)
{
return printType
string Fallback(object obj) => printType
? $"{currentTypeName}({SerializationHelper.SerializeOnlyNonComplexProperties(obj)})"
: $"{SerializationHelper.SerializeOnlyNonComplexProperties(obj)}";
}

string FormatModel(string inner)
{
return printType
string FormatModel(string inner) => printType
? $"{currentTypeName}({inner})"
: $"{inner}";
}

return model switch
{
Expand All @@ -74,7 +68,7 @@ string FormatModel(string inner)
KXP.Models.CmsConsentAgreement item => FormatModel($"ID={item.ConsentAgreementId}, GUID={item.ConsentAgreementGuid}"),
KXP.Models.CmsSettingsKey item => FormatModel($"ID={item.KeyId}, GUID={item.KeyGuid}, Name={item.KeyName}"),

Toolkit.K11.Models.CmsRole item => FormatModel($"ID={item.RoleId}, GUID={item.RoleGuid}, Name={item.RoleName}, SiteId={item.SiteId}"),
CmsRole item => FormatModel($"ID={item.RoleId}, GUID={item.RoleGuid}, Name={item.RoleName}, SiteId={item.SiteId}"),
CmsAttachment item => FormatModel($"ID={item.AttachmentId}, GUID={item.AttachmentGuid}, Name={item.AttachmentName}"),
CmsClass item => FormatModel($"ID={item.ClassId}, GUID={item.ClassGuid}, Name={item.ClassName}"),
CmsConsent item => FormatModel($"ID={item.ConsentId}, GUID={item.ConsentGuid}, Name={item.ConsentName}"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ protected override KXP.Models.CmsSettingsCategory MapInternal(CmsSettingsCategor
addFailure(new MapperResultFailure<KXP.Models.CmsSettingsCategory>(result.HandbookReference));
break;
}

default:
break;
}
}
}
Expand All @@ -79,6 +82,9 @@ protected override KXP.Models.CmsSettingsCategory MapInternal(CmsSettingsCategor
addFailure(new MapperResultFailure<KXP.Models.CmsSettingsCategory>(result.HandbookReference));
break;
}

default:
break;
}
}
else if (mappingHelper.TranslateIdAllowNulls<CmsCategory>(c => c.CategoryId, source.CategoryParentId, out int? categoryParentId))
Expand Down
3 changes: 3 additions & 0 deletions Migration.Toolkit.Core.K11/Mappers/OmContactMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ protected override KXP.Models.OmContact MapInternal(OmContact source, KXP.Models
addFailure(new MapperResultFailure<KXP.Models.OmContact>(result?.HandbookReference));
break;
}

default:
break;
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
.WithData(currentRow));
return ValueInterceptorResult.SkipRow;
}

default:
break;
}
}

Expand All @@ -210,6 +213,9 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
.WithData(currentRow));
return ValueInterceptorResult.SkipRow;
}

default:
break;
}
}

Expand All @@ -225,6 +231,9 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
.WithData(currentRow));
return ValueInterceptorResult.SkipRow;
}

default:
break;
}
}

Expand Down Expand Up @@ -337,6 +346,9 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin
return ValueInterceptorResult.SkipRow;
}
}

default:
break;
}
}

Expand Down
Loading

0 comments on commit ea5b2a6

Please sign in to comment.