Relationship problems #1466
Replies: 3 comments 2 replies
-
You mention the project build fails; do you mean that starting the Data Api builder engine fails, or that a CLI error is emitted?
|
Beta Was this translation helpful? Give feedback.
-
Thanks! I had to restart DAB to get the errors to go away. Is that normal? |
Beta Was this translation helpful? Give feedback.
-
hi @julianadormon, After adding the relationships, you can use nested filtering to filter on the GalleryTheme based on the event id 1234 (for eg) as follows:
|
Beta Was this translation helpful? Give feedback.
-
I am converting to DAB from Entity Framework.
I am trying to replicate the following query using graphql:
var GalleryTheme = await (from e in db.Events
from t in db.GalleryThemes
where e.EventId == PageVm.EventId
&& t.GalleryThemeId == e.GalleryThemeId
select new
{
OverlayFont = t.OverlayFont,
OverlayStripFont = t.OverlayStripFont,
OverlayMenuFont = t.OverlayMenuFont,
OverlayButtonFont = t.OverlayButtonFont,
ThumbnailMenuFont = t.ThumbnailMenuFont
}).AsNoTracking().SingleOrDefaultAsync();
with:
query GetGalleryThemeByEventId($input: Int!) {
event_by_pk(EventId: $input) {
EventId
GalleryTheme {
OverlayFont
OverlayStripFont
OverlayMenuFont
OverlayButtonFont
ThumbnailMenuFont
}
}
}
I created the relationships as follows:
Events can be linked to one GalleryTheme and a GalleyTheme can be linked to many Events.
dab update Event --relationship "GalleryTheme" --target.entity "GalleryTheme" --cardinality one --relationship.fields "GalleryThemeId:GalleryThemeId"
dab update GalleryTheme --relationship "Event" --target.entity "Event" --cardinality many --relationship.fields "GalleryThemeId:GalleryThemeId"
When building the project, the following error occurs:
The field
GalleryTheme
does not exist on the typeEvent
.I believe this is a Strawbery Shake error which I am using as a graphql client.
Also
Thanks?
Beta Was this translation helpful? Give feedback.
All reactions