Skip to content

Commit 402d9b8

Browse files
committed
fix(resolver): resolver for hypercert.fractions and fractions.hypercert
1 parent 5770e5e commit 402d9b8

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

src/graphql/schemas/resolvers/baseTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export function createBaseResolver<T extends ClassType>(
137137
.execute(async (transaction) => {
138138
const dataRes = await transaction.executeQuery(queries.data);
139139
const countRes = await transaction.executeQuery(queries.count);
140+
140141
return {
141142
data: dataRes.rows,
142143
count: countRes.rows[0].count,

src/graphql/schemas/resolvers/hypercertResolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ class HypercertResolver extends HypercertBaseResolver {
6969

7070
@FieldResolver()
7171
async fractions(@Root() hypercert: Hypercert) {
72-
if (!hypercert.id) {
72+
if (!hypercert.hypercert_id) {
7373
return;
7474
}
7575

7676
return await this.getFractions(
77-
{ where: { hypercerts: { id: { eq: hypercert.id } } } },
77+
{ where: { hypercert_id: { eq: hypercert.hypercert_id } } },
7878
false,
7979
);
8080
}

src/services/SupabaseCachingService.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,14 @@ export class SupabaseCachingService {
129129
return this.db.selectFrom("contracts").selectAll();
130130
case "fractions":
131131
case "fractions_view":
132-
return this.db
133-
.selectFrom("fractions_view")
134-
.selectAll()
135-
.$if(args.where?.hypercerts, (qb) =>
136-
qb.leftJoin(
137-
"claims",
138-
"claims.hypercert_id",
139-
"fractions_view.hypercert_id",
140-
),
141-
);
132+
return this.db.selectFrom("fractions_view").selectAll();
133+
// .$if(args.where?.hypercerts, (qb) =>
134+
// qb.leftJoin(
135+
// "claims",
136+
// "claims.hypercert_id",
137+
// "fractions_view.hypercert_id",
138+
// ),
139+
// );
142140
case "metadata":
143141
return this.db
144142
.selectFrom("metadata")
@@ -184,8 +182,8 @@ export class SupabaseCachingService {
184182
.select((expressionBuilder) => {
185183
return expressionBuilder.fn.countAll().as("count");
186184
});
187-
case "hypercerts":
188185
case "claims":
186+
case "hypercerts":
189187
return this.db
190188
.selectFrom("claims")
191189
.$if(args.where?.metadata, (qb) =>
@@ -211,9 +209,6 @@ export class SupabaseCachingService {
211209
case "fractions_view":
212210
return this.db
213211
.selectFrom("fractions_view")
214-
.$if(args.where?.hypercerts, (qb) =>
215-
qb.innerJoin("claims", "claims.id", "fractions_view.claims_id"),
216-
)
217212
.select((expressionBuilder) => {
218213
return expressionBuilder.fn.countAll().as("count");
219214
});

0 commit comments

Comments
 (0)