Category: tech-debt
Problem
None of src/settlements/entities/settlement.entity.ts (merchantId), src/webhooks/entities/webhook.entity.ts (merchantId), or src/blockchain-wallet/entities/blockchain-wallet.entity.ts (stellarAddress/userId are unique but every other query path, e.g. by status) has explicit @Index decorators — compare with src/groups/entities/group.entity.ts and src/notifications/entities/notification-preference.entity.ts, which do use @Index.
Impact
Inconsistent indexing strategy across the entity layer: some modules were clearly built with query performance in mind and others weren't, which will surface as slow admin/merchant list queries once these tables have production-scale row counts.
Suggested fix
Audit all 23 entities' actual query patterns (services' where clauses) against their @Index coverage and add a migration that backfills the missing ones, particularly settlements.merchantId and webhooks.merchantId.
Category: tech-debt
Problem
None of src/settlements/entities/settlement.entity.ts (
merchantId), src/webhooks/entities/webhook.entity.ts (merchantId), or src/blockchain-wallet/entities/blockchain-wallet.entity.ts (stellarAddress/userIdare unique but every other query path, e.g. by status) has explicit@Indexdecorators — compare with src/groups/entities/group.entity.ts and src/notifications/entities/notification-preference.entity.ts, which do use@Index.Impact
Inconsistent indexing strategy across the entity layer: some modules were clearly built with query performance in mind and others weren't, which will surface as slow admin/merchant list queries once these tables have production-scale row counts.
Suggested fix
Audit all 23 entities' actual query patterns (services'
whereclauses) against their@Indexcoverage and add a migration that backfills the missing ones, particularlysettlements.merchantIdandwebhooks.merchantId.