From a49d6ebfc4ae75cbb04a6d20af817b9e516b796e Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Sun, 7 Jun 2026 07:19:32 +0400 Subject: [PATCH] =?UTF-8?q?docs:=20sync=20from=20backend=20f5e53cb=20?= =?UTF-8?q?=E2=80=94=20M24=20DISTINCT=20ON,=20M30=20blog=20indexes,=20M39?= =?UTF-8?q?=20notification=20enums?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09 - Audits/Activity Log.md | 10 ++++++++++ 09 - Audits/DB Query & Schema Audit - 2026-06-06.md | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/09 - Audits/Activity Log.md b/09 - Audits/Activity Log.md index 8f57725..d89c7c0 100644 --- a/09 - Audits/Activity Log.md +++ b/09 - Audits/Activity Log.md @@ -12,6 +12,16 @@ entries on top. Maintained by agents per the rule in `../AGENTS.md`. --- +### 2026-06-07 — backend@f5e53cb — DB audit medium batch M24/M30/M39 + +**Commits:** `f5e53cb` +**Touched:** backend `src/db/repositories/drizzle/DrizzlePaymentRepo.ts`, `src/db/schema/blogPost.ts`, `src/db/schema/notification.ts`, `src/db/migrations/0021_needy_carlie_cooper.sql`, `package.json`, `package-lock.json`; docs `09 - Audits/DB Query & Schema Audit - 2026-06-06.md`, `09 - Audits/Activity Log.md` +**Why:** Close Medium M24 by replacing in-memory deduplication with Postgres DISTINCT ON for payment latest-per-request lookups. Close Medium M30 by adding GIN index on blog_posts.tags and converting status to pgEnum. Close Medium M39 by converting notifications.type and notifications.category to pgEnum for DB-level type safety. +**Verification:** backend `npm run typecheck` (clean), `npm test -- --runTestsByPath __tests__/db-audit-critical-fks.test.ts __tests__/drizzle-marketplace-repo-batch.test.ts --runInBand` (2 suites / 8 tests passed). Pushed to Forgejo. +**Linked docs updated:** [[09 - Audits/DB Query & Schema Audit - 2026-06-06]] + +--- + ### 2026-06-07 — backend@8fc2309 — DB audit M43/M44 missing FKs + H37 dispute enums **Commits:** `8fc2309` diff --git a/09 - Audits/DB Query & Schema Audit - 2026-06-06.md b/09 - Audits/DB Query & Schema Audit - 2026-06-06.md index 7fab12b..9f96709 100644 --- a/09 - Audits/DB Query & Schema Audit - 2026-06-06.md +++ b/09 - Audits/DB Query & Schema Audit - 2026-06-06.md @@ -824,7 +824,7 @@ Lines 558-564 call `paymentRepo.list({ provider: 'shkeeper', direction: 'in', st --- -### 24. findByPurchaseRequestIdsAndStatuses latestPerRequest deduplication fetches all historical rows then filters in JS +### 24. findByPurchaseRequestIdsAndStatuses latestPerRequest deduplication fetches all historical rows then filters in JS | **FIXED** `f5e53cb` v2.9.31 > **Category:** Unbounded Fetch | **File:** `src/db/repositories/drizzle/DrizzlePaymentRepo.ts:444-475` @@ -884,7 +884,7 @@ Lines 222-231 fetch the buyer's 20 most recent requests (`limit: 20`) then call --- -### 30. blog_posts.tags GIN index and ILIKE search indexes missing +### 30. blog_posts.tags GIN index and ILIKE search indexes missing | **FIXED** `f5e53cb` v2.9.31 > **Category:** Missing Index | **File:** `src/db/schema/blogPost.ts:49, 61-71` @@ -974,7 +974,7 @@ The `reviews` table uses `seller_legacy_object_id text` and `reviewer_legacy_obj --- -### 39. notifications.type and notifications.category lack pgEnum — any string accepted by Postgres +### 39. notifications.type and notifications.category lack pgEnum — any string accepted by Postgres | **FIXED** `f5e53cb` v2.9.31 > **Category:** Wrong Schema | **File:** `src/db/schema/notification.ts:24-25`