Skip to content

Commit 0f2ba28

Browse files
committed
feat(json-api-context): store a list of relationships to update
when PATCHing entities, we need to know which relationships to also PATCH
1 parent 402d6cc commit 0f2ba28

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/JsonApiDotNetCore/Services/IJsonApiContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JsonApiDotNetCore.Configuration;
44
using JsonApiDotNetCore.Internal;
55
using JsonApiDotNetCore.Internal.Query;
6+
using JsonApiDotNetCore.Models;
67

78
namespace JsonApiDotNetCore.Services
89
{
@@ -20,5 +21,6 @@ public interface IJsonApiContext
2021
PageManager PageManager { get; set; }
2122
IMetaBuilder MetaBuilder { get; set; }
2223
IGenericProcessorFactory GenericProcessorFactory { get; set; }
24+
Dictionary<RelationshipAttribute, object> RelationshipsToUpdate { get; set; }
2325
}
2426
}

src/JsonApiDotNetCore/Services/JsonApiContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using JsonApiDotNetCore.Configuration;
55
using JsonApiDotNetCore.Internal;
66
using JsonApiDotNetCore.Internal.Query;
7+
using JsonApiDotNetCore.Models;
78
using Microsoft.AspNetCore.Http;
89

910
namespace JsonApiDotNetCore.Services
@@ -23,6 +24,7 @@ public JsonApiContext(
2324
Options = options;
2425
MetaBuilder = metaBuilder;
2526
GenericProcessorFactory = genericProcessorFactory;
27+
RelationshipsToUpdate = new Dictionary<RelationshipAttribute, object>();
2628
}
2729

2830
public JsonApiOptions Options { get; set; }
@@ -36,6 +38,7 @@ public JsonApiContext(
3638
public PageManager PageManager { get; set; }
3739
public IMetaBuilder MetaBuilder { get; set; }
3840
public IGenericProcessorFactory GenericProcessorFactory { get; set; }
41+
public Dictionary<RelationshipAttribute, object> RelationshipsToUpdate { get; set; }
3942

4043
public IJsonApiContext ApplyContext<T>()
4144
{

0 commit comments

Comments
 (0)