msupply-foundation / unified-codes

Provides a curated, searchable list of pharmaceutical products, each with an immutable code. A GraphQL API, a REST API and website are available for interaction with the database.
https://codes.msupply.foundation
2 stars 0 forks source link

Fix the Product request on entities query #609

Closed jmbrunskill closed 7 months ago

jmbrunskill commented 7 months ago

Fixes #608

Description

Requesting product on an entities query such as mSupply does now works.

query{
    entities(filter: { description: "para" type: "drug unit_of_use medicinal_product" orderBy: { field: "description" descending: false } } offset: 0 first: 25) { data { code description type properties { type value } product { properties { type value } } }, totalLength }
}

Tests:

No tests have been added, would be nice to have those integration test we had in jest to update...

lache-melvin commented 7 months ago

No tests have been added, would be nice to have those integration test we had in jest to update...

We do have these? https://github.com/msupply-foundation/unified-codes/blob/develop/frontend/integration/v1_graphql_entity.int.ts

Run with yarn test-integration

jmbrunskill commented 7 months ago

No tests have been added, would be nice to have those integration test we had in jest to update...

We do have these? https://github.com/msupply-foundation/unified-codes/blob/develop/frontend/integration/v1_graphql_entity.int.ts

Run with yarn test-integration

Ah nice, for some reason I thought we'd lost them as we were going to move to rust ones. I'll update...

lache-melvin commented 7 months ago

Actually! Tests aren't compiling... 😅

error[E0609]: no field `properties` on type `EntityData`
   --> dgraph/src/entities.rs:134:23
    |
134 |         assert!(!data.properties.is_empty())
    |                       ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `data`, `aggregates`