docs: sync from backend 3ad3bbe — db audit chat notification batch

This commit is contained in:
Siavash Sameni
2026-06-06 20:18:22 +04:00
parent df8eba1233
commit 01aad6977a
2 changed files with 14 additions and 0 deletions

View File

@@ -11,6 +11,16 @@ entries on top. Maintained by agents per the rule in `../AGENTS.md`.
---
### 2026-06-06 — backend@3ad3bbe, frontend@a78d2a9 — DB audit chat and notification bulk batch
**Commits:** `3ad3bbe` `a78d2a9`
**Touched:** backend `src/db/repositories/drizzle/DrizzleChatRepo.ts`, `src/db/schema/chat.ts`, `src/db/migrations/0020_chat_jsonb_indexes.sql`, `src/db/repositories/drizzle/DrizzleMarketplaceRepo.ts`, `src/db/repositories/drizzle/DrizzleNotificationRepo.ts`, `src/services/notification/NotificationService.ts`, `src/services/notification/notificationController.ts`, focused Jest tests, `scripts/smoke/db-audit-service-regressions.sh`, version files; frontend `package.json`; docs `09 - Audits/DB Query & Schema Audit - 2026-06-06.md`
**Why:** Continue the 2026-06-06 DB audit: push common chat filters into SQL, add chat JSONB GIN indexes, batch latest-payment lookup for buyer purchase request lists, and replace notification bulk mark/delete serial loops with capped set-based repo writes.
**Verification:** backend `npm test -- --runTestsByPath __tests__/drizzle-chat-repo.test.ts __tests__/drizzle-notification-repo-bulk.test.ts __tests__/notification-controller-bulk.test.ts __tests__/notification-service-repo.test.ts --runInBand`, `npm run typecheck`, `BASE_URL=http://127.0.0.1:5001 scripts/smoke/db-audit-service-regressions.sh`, `git diff --check`; frontend package bump diff check. Pushed to Forgejo; `origin` remained unavailable and was intentionally skipped.
**Linked docs updated:** [[09 - Audits/DB Query & Schema Audit - 2026-06-06]]
---
### 2026-06-06 — backend@2a56f98, frontend@7b52dcf — DB audit service query batching batch 2
**Commits:** `2a56f98` `7b52dcf`

View File

@@ -24,6 +24,10 @@ updated: 2026-06-06
| Offer acceptance loser notifications: sequential per-offer INSERTs → one `createNotificationsBulk` call | `2a56f98` v2.9.15 |
| Template batch conversion: first-seller templates fetched twice → first-pass template cache reused | `2a56f98` v2.9.15 |
| Dispute statistics: four repeated status count scans → one status `GROUP BY` query | `2a56f98` v2.9.15 |
| Chat query reads: full-table `findRows()` scan → SQL pushdown for participant/archive/unread filters with in-memory fallback only for unsupported predicates | `3ad3bbe` v2.9.16 |
| Chat JSONB filters: missing `participants`/`unread_counts` GIN indexes → added schema indexes and migration `0020_chat_jsonb_indexes.sql` | `3ad3bbe` v2.9.16 |
| Buyer purchase request list: per-request latest-payment lookup → one `DISTINCT ON (purchase_request_id)` payment query per page | `3ad3bbe` v2.9.16 |
| Notification bulk mark/delete: serial per-id writes with no cap → set-based repo operations plus 100-id API cap | `3ad3bbe` v2.9.16 |
---