diff --git a/.editorconfig b/.editorconfig deleted file mode 120000 index 3ca15af8..00000000 --- a/.editorconfig +++ /dev/null @@ -1 +0,0 @@ -Settings/.editorconfig \ No newline at end of file diff --git a/csharp/Platform.Data.Doublets.Gql.Schema/Types/LinksType.cs b/csharp/Platform.Data.Doublets.Gql.Schema/Types/LinksType.cs index b787ac36..03b49be8 100644 --- a/csharp/Platform.Data.Doublets.Gql.Schema/Types/LinksType.cs +++ b/csharp/Platform.Data.Doublets.Gql.Schema/Types/LinksType.cs @@ -21,10 +21,13 @@ public LinksType() Field>(nameof(MappedType.in_aggregate), null, LinksQuery.Arguments, ResolveInAggregate); Field>>>(nameof(MappedType.@out), null, LinksQuery.Arguments, ResolveOut); Field>(nameof(MappedType.out_aggregate), null, LinksQuery.Arguments, ResolveOutAggregate); + Field(nameof(MappedType.@string)); Field(o => o.to, true, typeof(LinksType)).Resolve(ResolveTo); Field>(nameof(MappedType.to_id)); Field(o => o.type, true, typeof(LinksType)).Resolve(ResolveType); Field>(nameof(MappedType.type_id)); + Field("from_string", resolve: context => ResolveFromString(context)); + Field("to_string", resolve: context => ResolveToString(context)); } private LinksAggregateType ResolveInAggregate(IResolveFieldContext context) => new(); @@ -41,6 +44,18 @@ public LinksType() private Links ResolveType(IResolveFieldContext context) => context.Source.type ?? GetLinkOrDefault(context, (long?)context.Source.type_id); + private string ResolveFromString(IResolveFieldContext context) + { + var fromLink = context.Source.from ?? GetLinkOrDefault(context, context.Source.from_id); + return fromLink?.@string; + } + + private string ResolveToString(IResolveFieldContext context) + { + var toLink = context.Source.to ?? GetLinkOrDefault(context, context.Source.to_id); + return toLink?.@string; + } + public static Links GetLinkOrDefault(IResolveFieldContext context, long? linkId) => linkId != null ? GetLinkOrDefault(context.RequestServices.GetService>(), (ulong)linkId) : default; public static Links GetLinkOrDefault(object service, long linkId) => GetLinkOrDefault((ILinks)service, (ulong)linkId);