Skip to content

Commit

Permalink
add number fetch to the sql
Browse files Browse the repository at this point in the history
  • Loading branch information
brady.ouren committed Jul 23, 2024
1 parent af1c502 commit 339d63c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/src/pg/pg-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class PgStore extends BasePgStore {
const results = await this.sql<DbCountedQueryResult<DbItemWithRune<DbLedgerEntry>>[]>`
WITH ${cte ? cte : this.sql`none AS (SELECT NULL)`},
results AS (
SELECT l.*, r.name, r.spaced_name, r.divisibility, ${count} AS total
SELECT l.*, r.name, r.number, r.spaced_name, r.divisibility, ${count} AS total

Check warning on line 149 in api/src/pg/pg-store.ts

View check run for this annotation

Codecov / codecov/patch

api/src/pg/pg-store.ts#L149

Added line #L149 was not covered by tests
FROM ledger AS l
INNER JOIN runes AS r ON r.id = l.rune_id
WHERE ${filter}
Expand Down Expand Up @@ -222,7 +222,7 @@ export class PgStore extends BasePgStore {
): Promise<DbPaginatedResult<DbItemWithRune<DbBalance>>> {
const results = await this.sql<DbCountedQueryResult<DbItemWithRune<DbBalance>>[]>`
WITH grouped AS (
SELECT DISTINCT ON (b.address) b.address, b.balance, b.total_operations, b.rune_id, r.name,
SELECT DISTINCT ON (b.address) b.address, b.balance, b.total_operations, b.rune_id, r.name, r.number

Check warning on line 225 in api/src/pg/pg-store.ts

View check run for this annotation

Codecov / codecov/patch

api/src/pg/pg-store.ts#L225

Added line #L225 was not covered by tests
r.spaced_name, r.divisibility, COUNT(*) OVER() AS total
FROM balance_changes AS b
INNER JOIN runes AS r ON r.id = b.rune_id
Expand All @@ -245,7 +245,7 @@ export class PgStore extends BasePgStore {
): Promise<DbItemWithRune<DbBalance> | undefined> {
const results = await this.sql<DbItemWithRune<DbBalance>[]>`
SELECT b.rune_id, b.address, b.balance, b.total_operations, r.name,
r.spaced_name, r.divisibility, COUNT(*) OVER() AS total
r.number, r.spaced_name, r.divisibility, COUNT(*) OVER() AS total

Check warning on line 248 in api/src/pg/pg-store.ts

View check run for this annotation

Codecov / codecov/patch

api/src/pg/pg-store.ts#L248

Added line #L248 was not covered by tests
FROM balance_changes AS b
INNER JOIN runes AS r ON r.id = b.rune_id
WHERE ${runeFilter(this.sql, id, 'r')} AND address = ${address}
Expand All @@ -263,7 +263,7 @@ export class PgStore extends BasePgStore {
const results = await this.sql<DbCountedQueryResult<DbItemWithRune<DbBalance>>[]>`
WITH grouped AS (
SELECT DISTINCT ON (b.rune_id) b.address, b.balance, b.total_operations, b.rune_id, r.name,
r.spaced_name, r.divisibility, COUNT(*) OVER() AS total
r.number, r.spaced_name, r.divisibility, COUNT(*) OVER() AS total

Check warning on line 266 in api/src/pg/pg-store.ts

View check run for this annotation

Codecov / codecov/patch

api/src/pg/pg-store.ts#L266

Added line #L266 was not covered by tests
FROM balance_changes AS b
INNER JOIN runes AS r ON r.id = b.rune_id
WHERE address = ${address}
Expand Down

0 comments on commit 339d63c

Please sign in to comment.