Skip to content

Commit 4c85c18

Browse files
committed
fix(fractions): query on fractions view with hypercert_id
1 parent 1b3aa74 commit 4c85c18

File tree

2 files changed

+10
-36
lines changed

2 files changed

+10
-36
lines changed

pnpm-lock.yaml

Lines changed: 1 addition & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/SupabaseCachingService.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export class SupabaseCachingService {
5555

5656
getFractions(args: GetFractionsArgs) {
5757
return {
58-
data: this.handleGetData("fractions", args),
59-
count: this.handleGetCount("fractions", args),
58+
data: this.handleGetData("fractions_view", args),
59+
count: this.handleGetCount("fractions_view", args),
6060
};
6161
}
6262

@@ -126,11 +126,12 @@ export class SupabaseCachingService {
126126
case "contracts":
127127
return this.db.selectFrom("contracts").selectAll();
128128
case "fractions":
129+
case "fractions_view":
129130
return this.db
130-
.selectFrom("fractions")
131-
.selectAll("fractions")
131+
.selectFrom("fractions_view")
132+
.selectAll()
132133
.$if(args.where?.hypercerts, (qb) =>
133-
qb.innerJoin("claims", "claims.id", "fractions.claims_id"),
134+
qb.innerJoin("claims", "claims.id", "fractions_view.claims_id"),
134135
);
135136
case "metadata":
136137
return this.db
@@ -201,10 +202,11 @@ export class SupabaseCachingService {
201202
return expressionBuilder.fn.countAll().as("count");
202203
});
203204
case "fractions":
205+
case "fractions_view":
204206
return this.db
205-
.selectFrom("fractions")
207+
.selectFrom("fractions_view")
206208
.$if(args.where?.hypercerts, (qb) =>
207-
qb.innerJoin("claims", "claims.id", "fractions.claims_id"),
209+
qb.innerJoin("claims", "claims.id", "fractions_view.claims_id"),
208210
)
209211
.select((expressionBuilder) => {
210212
return expressionBuilder.fn.countAll().as("count");

0 commit comments

Comments
 (0)