-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Bug]: MemoryDatabase/Store does not correctly handle entity relationships #1096
Comments
Hi @spacedragon and @zfy0701 I've updated to Could you please investigate? |
Hey @spacedragon thanks, that makes sense. However, how am I supposed to access // This does NOT work
it('should ...', withStoreContext(storeContext, async () => {
const store = new Store(storeContext)
// rest of the test implementation that uses the above store will not work as it's different from ctx.store that is used in the event handlers
})) |
access through Take a look at this docs I recently updated. |
Hey @spacedragon I'm attempting to get
|
I see you try to access the |
thanks @spacedragon upgrading to |
Description
The
MemoryDatabase
/Store
implementation currently does not properly handle entity relationships as defined in the GraphQL schema. This affects the ability to traverse relationships between entities, which is crucial for proper data modeling and querying.Test Cases Added
I've added test cases to
./packages/sdk/src/store/tests/database.test.ts
that demonstrate the expected behavior for relationship traversal. These tests currently fail, highlighting the gaps in the current implementation.The test cases verify the following relationship patterns:
Expected Behavior
The database should allow traversal of relationships as defined in the GraphQL schema, maintaining referential integrity and proper type information. This includes:
Current Behavior
Currently, attempting to traverse these relationships fails.
Alternatives
There are a few approaches to handle entity relationships:
receipt.transactionID
to query the transaction separately viastore.get(Transaction, receipt.transactionID)
Promise
properties withPromise
-returning functionsreceipt.transaction()
instead ofreceipt.transaction
The text was updated successfully, but these errors were encountered: