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/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b43a9c67 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.cs] +indent_style = space +indent_size = 4 \ No newline at end of file diff --git a/csharp/Platform.Data.Doublets.Gql.Schema/LinksMutation.cs b/csharp/Platform.Data.Doublets.Gql.Schema/LinksMutation.cs index 9c3a63b4..56357f30 100644 --- a/csharp/Platform.Data.Doublets.Gql.Schema/LinksMutation.cs +++ b/csharp/Platform.Data.Doublets.Gql.Schema/LinksMutation.cs @@ -68,7 +68,32 @@ public static Links InsertLink(object service, Links links) public static Links InsertLink(object service, LinksInsert linksInsert) { var link = (ILinks)service; - var create = link.GetOrCreate((ulong)(linksInsert.from_id ?? 0), (ulong)(linksInsert.to_id ?? 0)); + + // Handle nested 'from' object + ulong fromId = 0; + if (linksInsert.from?.data != null) + { + var fromLink = InsertLink(service, linksInsert.from.data); + fromId = (ulong)fromLink.id; + } + else if (linksInsert.from_id.HasValue) + { + fromId = (ulong)linksInsert.from_id.Value; + } + + // Handle nested 'to' object + ulong toId = 0; + if (linksInsert.to?.data != null) + { + var toLink = InsertLink(service, linksInsert.to.data); + toId = (ulong)toLink.id; + } + else if (linksInsert.to_id.HasValue) + { + toId = (ulong)linksInsert.to_id.Value; + } + + var create = link.GetOrCreate(fromId, toId); return LinksType.GetLinkOrDefault(service, (long)create); } } diff --git a/csharp/Platform.Data.Doublets.Gql.Schema/LinksObjRelInsert.cs b/csharp/Platform.Data.Doublets.Gql.Schema/LinksObjRelInsert.cs index dbee5c25..8749ecc7 100644 --- a/csharp/Platform.Data.Doublets.Gql.Schema/LinksObjRelInsert.cs +++ b/csharp/Platform.Data.Doublets.Gql.Schema/LinksObjRelInsert.cs @@ -2,7 +2,7 @@ { public class LinksObjRelInsert { - public LinksObjRelInsert data { get; set; } + public LinksInsert data { get; set; } public LinksOnConflict on_conflict { get; set; } }