typicode / json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Other
73.05k stars 7.02k forks source link

Error in Query Response when Using Relationship in v1.0.0-alpha.16 #1480

Closed cleicastro closed 10 months ago

cleicastro commented 10 months ago

I'm currently working with version 1.0.0-alpha.16, and I've encountered an error in the query response when attempting to use relationships.

typicode commented 10 months ago

Hi, could you please provide a failing example? (route and db)

cleicastro commented 10 months ago

Error: TypeError: query._embed?.forEach is not a function at Service.findById

Route: http://localhost:3000/orders/1?_embed=shifts

db: { "orders": [ { "id": "1", "date": "2023-11-02" } ], "shifts": [ { "id": "fasdljr34r", "orderId": "1", "name": "Turno 1", "asCreated": "2023-11-02T00:02:9000", "asFineshed": "2023-11-02T08:11:0000", "status": false }, { "id": "24234fa", "orderId": "1", "name": "Turno 2", "asCreated": "2023-11-02T08:12:9000", "asFineshed": "2023-11-02T16:01:0000", "status": false }, { "id": "cb64", "orderId": "1", "name": "Turno 3", "asCreated": "2024-01-10T20:09:53.580Z", "asFineshed": null, "status": true } ] }

typicode commented 10 months ago

Thank you. Fixed in alpha.19