feat(sase): founder notes — Phase A of user mutations

Panel-side only — first writable feature on the Sase user detail page.
Notes are stored in the panel database (sase_user_notes); the spoke is
never touched (KVKK minimize).

Model
- SaseUserNote { id, saseUserId, authorUserId, body, pinned, createdAt }
- Index on (saseUserId, pinned, createdAt) for the default render order

API
- GET  /api/sase/users/[id]/notes — list (pinned first, then newest)
- POST /api/sase/users/[id]/notes — { body, pinned } create (audit'li)
- PATCH/DELETE /api/sase/notes/[noteId] — toggle pin / hard delete

UI
- New "Notlar" tab on user detail. Textarea + pinned checkbox + submit;
  list shows TR-localized timestamps, per-row pin/unpin and delete.

Schema sync
- package.json `start` now runs `prisma db push --skip-generate` before
  `next start`. Panel uses db-push style (no migrations dir); this lets
  the new table land on next deploy without a separate manual step.
  Future destructive changes will require a smarter migration approach.

teknikborc.md updated: super_panel_reader role still needs to be created
on the new sase-postgres (current panel uses sase superuser).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Semih
2026-05-18 09:32:48 +03:00
parent d8c2bdd22f
commit 5b26d10485
7 changed files with 315 additions and 1 deletions

View File

@@ -27,6 +27,22 @@ PRD'de "founder müdahale frekansı en yüksek" varsayımı EFT idi; Stripe sonr
- `apps/api/src/common/guards/internal-token.guard.ts` — X-Internal-Token doğrulama, panel→Sase.tr tüm `/internal/admin/*` çağrıları için temel. Henüz hiçbir endpoint kullanmıyor; ilk mutation eklendiğinde bağlanır.
### Sase RO connection — `super_panel_reader` rolü oluştur (geçici çözüm)
2026-05-18 itibarıyla panel `DATABASE_URL_SASE_RO` env'i Sase.tr'nin kendi `sase-postgres` (Coolify standalone DB, `v48gwwo48w8gg0ko0wg0ocko:5432`) üzerinde **`sase` superuser** ile çalışıyor. Bu hızlı bir fix — eskiden `coolify-db`'deki `sase` schema'sında `super_panel_reader` (SELECT-only) rolü vardı; Sase.tr ayrı bir DB'ye geçince o rol kayboldu.
Yapılacak:
```sql
CREATE ROLE super_panel_reader LOGIN PASSWORD '<rand>';
GRANT CONNECT ON DATABASE sase TO super_panel_reader;
GRANT USAGE ON SCHEMA public TO super_panel_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO super_panel_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO super_panel_reader;
```
Sonra panel-web `DATABASE_URL_SASE_RO` env'ini bu role çevir.
**Neden ertelenebilir:** Panel sadece RO query yapıyor; superuser olsa da panel-side write yok. Riski sınırlı ama defense-in-depth için temizlenmeli.
---
## insight