-
-
Notifications
You must be signed in to change notification settings - Fork 158
Hooks #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Hooks #478
Changes from 1 commit
Commits
Show all changes
185 commits
Select commit
Hold shift + click to select a range
eed794a
feat(business-logic): added more integration with ResourceDefinition
9fee385
feat(business-logic): added some preliminary code
d7c9331
feat: added first version of logic tree traversing
b8e4b99
feat: added logic when retrieving information
128fbc4
feat: first ever working test on resourcedefinition
c6f94bb
chore: cleanup of unused functions, restored original usage of Includ…
maurei 46ba26d
feat: abstracted resource definition logic into ResourceLogicExecutor…
maurei 870cc25
feat: draft setup for "resource hooks"
maurei f2373da
feat: introduced ResourceHookExecutor and ResourceHookContainer abstr…
maurei cf294f8
feat: improved proposal resource hooks
maurei 7f8c550
tests: hook discovery test (with implementation) and scaffolded some …
maurei 826ee9a
feat: wired up AfterDelete and BeforeDelete, created tests for all of…
maurei 3aa5123
chore: explanations added to classes involved in hook execution
maurei 113610e
chore: typo in comments
maurei 8af48d4
fix: naming rule violation
maurei 035b674
fix: edge case
maurei f2d446a
fix: previous rename caused dotnet to crash
maurei 9a64aad
feat: first version of generic tree traversing
maurei 690aa02
feat: more performant version of traversal
maurei 945abb4
chore: prior tests are passing again and updated implementation in se…
maurei 87289e2
test: updated unit tests for beforecreate and aftercreate
maurei 56d6708
test: made implementedhooks configurable
maurei 950c976
chore: reorganised hooks test
maurei 40ecd5e
feat: hook response validation, some more tests
maurei 383d15d
chore: compatability with prior tests, tests reorganized
maurei 906585e
feat: many-to-many support with identifiable jointable entity
maurei 94608fa
feat: many-to-many support with non-identifiable jointable entities
maurei a3c5397
fix: sln merge conflict
maurei f58c3c8
feat: added support for entities datasets with populated inverse navi…
maurei 20b7c49
test: some complex scenario tests
maurei d4527ef
chore: wired up service layer to hook executor
maurei d27fec0
fix: modelbuilder update
maurei 9c0893e
feat: backward compatible usage of resource hooks in service layer
maurei 2356673
feat: ability to disable resource hooks in startup configuration
maurei 5500998
fix: fixed some internal casting issues that occured during integrati…
maurei 62dff10
feat: breaking change (DeleteAsync) method in repository interface, c…
maurei 3b858f1
chore: reorganized resource hook files, updated comments
maurei d990504
chore: rm unused class
maurei 4965424
chore: updated tests with renamed classes, removed unused imports
maurei 1b3bf8c
chore: minor refactor and comment update in hook executor
maurei fc51de0
chore: simplified tests, cleanup unused imports
maurei 2446d86
chore: cleanup unused packages, typo in comments, whitespaces
maurei 876529b
docs: first version usage guide hooks
maurei f546600
Merge branch 'master' into feat/#477
maurei e22e954
fix: bad mergefix
maurei 30c1c4a
fix: adjusted order of execution hooks
maurei 6c00d28
docs: update hooks usage
maurei c61ea75
chore: decoupled ResourceHookExecutor from TEntity
maurei d11c611
fix: failing integration test
maurei df6ae88
chore: rm unused interface
maurei 409714f
chore: redundant itemgroup in csproj
maurei cb8a32e
test: does not fire nested hook when removing nested relationship
maurei c5a5b1c
test: cascade permission tests
maurei 656c9ae
fix: firing nested hooks when setting relationship to null
maurei b888a88
chore: comment in test
maurei 45b60c8
feat: first implementation with EntityDiff and HookContext
maurei 861f1d9
feat: first diff and hook context implementation finished (ie compiles)
maurei 5e84788
fix: compilation errors unit tests
maurei 072a728
test: unit tests passing again
maurei 20b0877
refactor: improvement in execution loop
maurei 0000f5e
refactor: renamed internal classes involved in traversal, fixed hasma…
maurei 723ea3a
feat: added correct status code
74e08d6
fix: nullcheck in service, query in no entity test: integration tests…
maurei 61dd367
chore: rm rogue files
maurei bf72290
test: re-added cascade permission tests
maurei e14e931
fix: cascade delete violation error in tests
maurei 8a8ec82
Merge branch 'feat/#477' of github.com:wisepotato/JsonApiDotNetCore i…
b0ed30a
chore: mv files and renamed variables
maurei 3bd339b
Merge branch 'feat/#477' of https://github.com/wisepotato/JsonApiDotN…
maurei c39f968
feat: first implementation database diff in hooks
maurei 05bf462
feat: database diff support implemented, about to fix broken tests
maurei e69a2f8
fix: previous tests passing again, change tracking errors remain
maurei fc4cfb6
docs: some doc cleaning + added todo
b3a7cbf
feat: refactor, implicit update draft
maurei 09d6a1e
feat: further implicit update support
maurei 0c70ed7
feat: simplified implementation: BeforeRead
maurei e9d5ed2
test: simplification BeforeRead
maurei f50550e
test: unit tests for simplification AfterRead
maurei b2ec87d
feat: simplifications AfterRead
maurei b695aa9
feat: unit, integration tests and hook implementation for simplified …
maurei 30e713b
Merge branch 'feat/#477' of https://github.com/wisepotato/JsonApiDotN…
maurei c6007ad
feat: simplified interface BeforeUpdate
maurei 5e5ba6f
test: unit tests BeforeUpdate
maurei 8b08443
feat: BeforeUpdate - further update interface and unit tests
maurei b73093c
feat: added identifiableComparer
cf792d4
Merge branch 'feat/#477' of github.com:wisepotato/JsonApiDotNetCore i…
caea445
Merge branch 'feat/#477' of https://github.com/wisepotato/JsonApiDotN…
maurei 5884058
feat: equality comparer hotfix
maurei bda613b
feat: simplified BeforeUpdate without edgecases
maurei c2604ad
feat: beforeupdate with implicit support
maurei 4a0d72d
feat: support implicit delete
maurei c4c6f22
feat: implicit principal support
maurei b73b5a8
test: implicit principal support
maurei 7267a76
test: implicit affected tests, principal and dependent
maurei 518f9d0
feat: reorganised after hooks interface
maurei 12fb3e7
chore: minor adjustments
maurei 4e77c9b
feat: added principal and dependent type to Relationship attribute
maurei 7ea03d8
feat: inverse relationship resolver
maurei 84c27b7
comment: InverseRelationshipResolver
maurei 2838443
feat: updated interface
maurei 86e7055
test: unit tests passing resource hooks
maurei d3aec2d
test: integration tests
maurei 34d67f7
feat: validate hook response for GetSingle
maurei 36754a7
chore: rm unused properties, spacing
maurei 876b839
fix: load db values for guid models
maurei 8f29b60
test: added missing implicit tests
maurei 9379d2f
fix: wrong pipeline in after read
maurei 4190368
feat: after update, after create
maurei 1d3a947
feat: get relationship behaves different in OnReturn
maurei 7888704
fix: hooks for cyclic relations and self multiple relations to same type
maurei 57fdb8c
refactor: traversal
maurei 07b0348
chore: spacing
maurei 68b6fcb
feat: RootNode<TEntity> draft
maurei 2c6f751
feat: hotfix for #507
6441e1a
refactor: clean up
maurei 6a0cc58
refactor: hooks namespace
maurei f21862c
Merge branch 'feat/#477' of https://github.com/wisepotato/JsonApiDotN…
maurei 34a138b
fix: db values not properly provided to hook
maurei b6af596
refactor: cast extension
maurei c693539
refactor: reorganised files
maurei cd26e13
refactor: rename attr
maurei ad89db9
chore: rename files
maurei eb41cfe
refactor: get hook helper
maurei 039e1b0
refactor: changed isRelated -> isIncluded for legibility
35bb793
comments: documentation
maurei e27eeb7
Merge branch 'feat/#477' of https://github.com/wisepotato/JsonApiDotN…
maurei d81350c
fix: spelling of 'instead'
bee21d7
comments: documentation
maurei 912bc2c
feat: entity diff includes relationshiphelper
maurei b64feac
comments: documentation in code
maurei ab1f96d
comments: IHookExecutorHelper
maurei 4a6e2e3
documentation: usage guide
maurei d7b5b55
documentation: finish
maurei 08917c7
documentation: usage guide update
maurei 71b3bd0
Update hooks.md
maurei 67ddff6
Update hooks.md
maurei 446dad3
fix: processed milous comments
maurei 7a737aa
fix: merge
maurei 0b1a40f
fix: wiring up resource definition to other repository constructors
maurei 86e11d4
feat: #500
maurei 5a141cf
fix: milou comments
maurei 553bf3e
fix: ambiguous constructor
maurei 37edd26
fix: ambiguous constructor
maurei 38cbed1
fix: downgrading test sdk for compatiblity with unix, see https://git…
maurei d22f417
fix: repo context issue
maurei f66f894
comment: update
maurei 1ecab38
refactor: rename pipeline enum members
maurei b5a27c4
refactor: renamed some internals, and added id to mapped out entity i…
maurei d089461
test: inheritance
maurei d7e71d8
fix: dont include when IsInclude is false
maurei d84f30f
feat: AuthResourceBase with default hook implementation
maurei c284ed9
chore: rename member
maurei 0a3605d
documentation: hooks
maurei b4777b4
docs: update hooks
maurei a8e3525
docs: update hooks guide
maurei 30f6e65
docs: fix typo hooks"
maurei e924833
chore: default value option
maurei 50d34b0
fix: default option loaddbvalues
maurei 0f385f1
y
maurei 762210e
tests: DRCU update tests
maurei bcf2dbc
chore: rm forgotten line
maurei 61c2e93
fix: removed usage of guid-based repositories
maurei c70dea4
documentation: enumeration change
maurei e184e7f
documentation: typo
maurei 61dc5d5
fix: remove unused code
maurei 50167e0
documentation: improve advanced auth example
maurei 61634f1
fix: reverted change of 2c6f751
maurei a1f5d12
feat: more structual ctors EntityResourceService
maurei b8df749
feat: improved loaddbvalues attribute error handling, refactored a bit
maurei 29abae0
refactor: renamed AffectedRelationships
maurei 8fc015a
feat: throw error if trying to access databasevalues when loading is …
maurei 59a9359
feat: IAffectedResource, IEntityDiff, IAffectedRelationships have upg…
maurei 6a7c8d1
documentation: upgrade
maurei e9d553f
fix: merge
maurei d6d4a61
refactor: rename entitydiff to resourcediff
maurei ad85758
fix: traversal bug related to parsing next layer relationships when l…
maurei 5cd07d5
fix: added backward compatability relationship attr equality check
maurei de82fee
fix: merge
maurei db5bf23
fix: merge
maurei 0290ae4
fix: separation and merge
maurei 86dfd8d
refactor: AffectedResourcesDiff
maurei 5ab6407
fix: inverse loading without inverse relationship attribute
maurei 1705bef
Merge branch 'fix/reattachment' into feat/#477
maurei 57a7971
fix: merge
maurei 6ccb1bb
fix: merge
maurei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using JsonApiDotNetCore.Logic; | ||
using JsonApiDotNetCore.Models; | ||
using JsonApiDotNetCoreExample.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace JsonApiDotNetCoreExample.Logic | ||
{ | ||
public class LogicCache : BaseLogicCache | ||
{ | ||
|
||
/// <summary> | ||
/// Hacky, but fast to show how it could work | ||
/// </summary> | ||
/// <param name="tagDefinition"></param> | ||
public LogicCache(ResourceDefinition<Tag> tagDefinition) | ||
{ | ||
_cache.Add(typeof(Tag), tagDefinition); | ||
} | ||
|
||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using JsonApiDotNetCore.Models; | ||
|
||
namespace JsonApiDotNetCore.Logic | ||
{ | ||
public interface ILogicCache | ||
{ | ||
IResourceDefinition GetLogic(Type type); | ||
} | ||
public class BaseLogicCache : ILogicCache | ||
maurei marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
protected Dictionary<Type, IResourceDefinition> _cache = new Dictionary<Type, IResourceDefinition>(); | ||
|
||
|
||
public IResourceDefinition GetLogic(Type type) | ||
{ | ||
var toReturn = _cache.FirstOrDefault(c => c.Key == type); | ||
if(toReturn.Equals(default(KeyValuePair<Type,IResourceDefinition>))) | ||
{ | ||
return null; | ||
} | ||
return toReturn.Value; | ||
} | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.