Category: Performance
Difficulty: Medium
Description
AdminDisputeService.getDisputes accepts page and limit, then does:
const allDisputes = await this.prisma.dispute.findMany({ where: ... });
const total = allDisputes.length;
const data = allDisputes.slice(start, start + limit);
The where narrows by status when one is supplied, but there is no skip, no take and no
orderBy. Page 1 of 20 costs the same as fetching every dispute, and the ordering is whatever the
database returns, so a row can appear on two pages or on none as data changes between requests.
Location
src/admin/dispute/dispute.service.ts
src/admin/dispute/dispute.controller.ts
test/integration/admin-disputes.integration-spec.ts
Example commits
perf(admin): paginate disputes in the database
test(admin): assert stable ordering across pages
Acceptance Criteria
Technical Notes
The in-memory PrismaService needs skip/take/orderBy support for dispute.findMany if it
does not have it; add it rather than special-casing the service.
Out of scope: changing the response envelope.
Before you start
- Set up with the steps in CONTRIBUTING.md. Node 22 is required (
.nvmrc), use npm ci rather than npm install, and copy .env.example to .env before running npx prisma generate — the Prisma config reads DATABASE_URL at load.
- Branch from
dev and open your pull request against dev. main is the released baseline.
- Tests that need an authenticated caller should use the
bearer() helper in test/auth-helper.ts, which mints a genuinely signed SEP-10 token. Do not send a raw Stellar address as a bearer token; that path was removed deliberately.
- You may cover more than one issue in a single pull request.
Category: Performance
Difficulty: Medium
Description
AdminDisputeService.getDisputesacceptspageandlimit, then does:The
wherenarrows by status when one is supplied, but there is noskip, notakeand noorderBy. Page 1 of 20 costs the same as fetching every dispute, and the ordering is whatever thedatabase returns, so a row can appear on two pages or on none as data changes between requests.
Location
src/admin/dispute/dispute.service.tssrc/admin/dispute/dispute.controller.tstest/integration/admin-disputes.integration-spec.tsExample commits
Acceptance Criteria
skip,takeand a deterministicorderBy.totalcomes from acountagainst the samewhere.pageandlimitare validated: rejected or clamped when below 1, andlimithas an upper bound.Technical Notes
The in-memory
PrismaServiceneedsskip/take/orderBysupport fordispute.findManyif itdoes not have it; add it rather than special-casing the service.
Out of scope: changing the response envelope.
Before you start
.nvmrc), usenpm cirather thannpm install, and copy.env.exampleto.envbefore runningnpx prisma generate— the Prisma config readsDATABASE_URLat load.devand open your pull request againstdev.mainis the released baseline.bearer()helper intest/auth-helper.ts, which mints a genuinely signed SEP-10 token. Do not send a raw Stellar address as a bearer token; that path was removed deliberately.