Skip to content

Commit

Permalink
Adjust hydrate for union of concretes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF authored and bryanjnelson committed Jun 12, 2024
1 parent 59d74ef commit 069b763
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/components/engagement/engagement.edgedb.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,46 @@ const baseHydrate = e.shape(e.Engagement, (engagement) => ({
completeDate: engagement.completedDate, // TODO fix in schema
}));

const languageExtraHydrate = e.shape(e.LanguageEngagement, (le) => ({

Check warning on line 43 in src/components/engagement/engagement.edgedb.repository.ts

View workflow job for this annotation

GitHub Actions / lint

'le' is defined but never used. Allowed unused args must match /^_/u
language: true,
firstScripture: true,
lukePartnership: true,
openToInvestorVisit: true,
sentPrintingDate: true,
paratextRegistryId: true,
pnp: true,
historicGoal: true,
}));

const internshipExtraHydrate = e.shape(e.InternshipEngagement, (ie) => ({

Check warning on line 54 in src/components/engagement/engagement.edgedb.repository.ts

View workflow job for this annotation

GitHub Actions / lint

'ie' is defined but never used. Allowed unused args must match /^_/u
countryOfOrigin: true,
intern: true,
mentor: true,
position: true,
methodologies: true,
growthPlan: true,
}));

const languageHydrate = e.shape(e.LanguageEngagement, (le) => ({
...le['*'],
...baseHydrate(le),
...languageExtraHydrate(le),
__typename: castToEnum(le.__type__.name.slice(9, null), [
'LanguageEngagement',
]),
language: true,
pnp: true,
}));

const internshipHydrate = e.shape(e.InternshipEngagement, (ie) => ({
...ie['*'],
...baseHydrate(ie),
...internshipExtraHydrate(ie),
__typename: castToEnum(ie.__type__.name.slice(9, null), [
'InternshipEngagement',
]),
intern: true,
mentor: true,
countryOfOrigin: true,
growthPlan: true,
}));

const hydrate = e.shape(e.Engagement, (engagement) => ({
...languageHydrate(engagement),
...internshipHydrate(engagement),
__typename: castToEnum(engagement.__type__.name.slice(9, null), [
'LanguageEngagement',
'InternshipEngagement',
]),
...baseHydrate(engagement),
...languageExtraHydrate(engagement),
...internshipExtraHydrate(engagement),
}));

export const ConcreteRepos = {
Expand Down

0 comments on commit 069b763

Please sign in to comment.