Untitled
unknown
plain_text
a year ago
1.3 kB
12
Indexable
There is little logic in the views, and it will be more effort to maintain them as requirements evolve than it will be to fetch the same data directly from the tables. Fetching the data directly from the tables gives us a lot of flexibility, too.
Once we setup the needed SQLAlchemy and GraphQL classes, we should be able to fetch data for the product list views like this:
GraphQL
{
# this will fetch data needed to render all the headers
fieldDetails(isActive: true, isDeleted: false) { # mdm_field_details
id
label
name
type
order
options
format
# etc
}
# this fetches the data to display
products(limit: 10, offset: 0) { # mdm_product
status { # mdm_status
id
name
description
}
therapeuticArea { # mdm_therapeutic
id
name
description
}
therapeuticAreaSubType
country { # mdm_countries
name
formalName
iso2CountryCode
iso3CountryCode
# etc
regions { # mdm_region_countries -> mdm_regions
id
name
code
}
}
# dynamic fields
fields(isDynamic: true, isActive: true, isDeleted: false) { # mdm_product_field
value
details { # mdm_field_details
id
# etc
}
}
}
}Editor is loading...
Leave a Comment