Skip to content
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

Missing order in API GET request #1186

Closed
Naegolus opened this issue Oct 4, 2024 · 2 comments
Closed

Missing order in API GET request #1186

Naegolus opened this issue Oct 4, 2024 · 2 comments
Assignees
Milestone

Comments

@Naegolus
Copy link

Naegolus commented Oct 4, 2024

Describe the bug

Missing order in API GET request with endpoint "/odata/v1/orders" although "@odata.count" tells me, it should be there.

To Reproduce

  1. Create a User
  2. Create an Order with that User
  3. Delete the User
  4. Make the following API GET request: "odata/v1/orders?%24count=true&%24expand=Customer"

Expected behavior

  • @odata.count should be 1
  • There should be one order in the order list, as announced by @odata.count. Therefore value.size() == 1
  • value[0].Customer should be null

Result

  • @odata.count is 1
  • BUT there is no order in the returned order list. Therefore value.size() == 0. This is a bug

Other use case which is working

  1. Create an Order with digital products only => No shipping required
  2. Make the following API GET request: "odata/v1/orders?%24count=true&%24expand=ShippingAddress"

In this case:

  • @odata.count == 1
  • value.size() == 1
  • value[0].ShippingAddress == null
@mgesing
Copy link
Contributor

mgesing commented Oct 14, 2024

Expected behavior

  • value[0].Customer should be null

The expanded customer cannot be null because the relationship is not optional. Thus each order has an associated customer, regardless of whether it is marked as deleted (soft-deleted entity). When customers are expanded, the related customer data is always returned.

Whether the customer is deleted can be verified via the Deleted property. This was formerly not possible because the Deleted property was previously not transmitted via the Web API, as it was decorated with the IgnoreDataMemberAttribute. This was also fixed with the above commit.

@Naegolus
Copy link
Author

Naegolus commented Oct 16, 2024

@mgesing
Are the first two points in "Expected behaviour" met after this fix then?

@odata.count should be 1
There should be one order in the order list, as announced by @odata.count. Therefore value.size() == 1

If this is the case, then it is fine for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants