feat(notes,profile): trash for notes and personal model connection check

Notes:
- soft delete via deleted_at/purge_at with trashPurgeDays(), restore and
  permanent-delete routes, ?deleted=1 list switch
- GET /api/notes now always returns only own notes (admin included)
- purge user_notes in purgeScheduledDeletions(), skip deleted rows in
  reorder and in the note title worker
- deleted_at/purge_at in init.sql, migration.sql, ensureUserNotesTable(),
  normalizeRestoreData and restore-insert

Profile:
- POST /api/user-settings/models/test probes a personal model from the
  client payload (works before save), shared probeAiModel() with the admin
  profile test, AI_MODEL_TEST_TIMEOUT_MS env in .env.example/compose
- "Проверить" button in the model list and in the model form
- password fields: autocomplete hints, values cleared on every toggle

Notes page: #notesDeleted trash toggle, deleted card state, restore/permanent
actions; fmtTs() uses the global fmtDateTime() instead of the non-existent
window.datetime.
This commit is contained in:
dev
2026-10-17 00:17:00 +03:00
parent 9ae54da2e4
commit 2f8c2da280
12 changed files with 303 additions and 71 deletions
+2 -2
View File
@@ -1520,7 +1520,7 @@ function createNoteTitleWorker({ pool, getSetting, logAudit, aiUrl, model, defau
const { rows } = await client.query(
`SELECT id, user_id, note, tags
FROM user_notes
WHERE ai_status = 'pending' AND title = ''
WHERE ai_status = 'pending' AND title = '' AND deleted_at IS NULL
ORDER BY id ASC LIMIT 1 FOR UPDATE SKIP LOCKED`
);
if (!rows.length) {
@@ -1619,7 +1619,7 @@ function createNoteTitleWorker({ pool, getSetting, logAudit, aiUrl, model, defau
`UPDATE user_notes SET
title = CASE WHEN $1 <> '' THEN $1 ELSE title END,
ai_status = $2, updated_at = now()
WHERE id = $3 AND ai_status = 'processing'`,
WHERE id = $3 AND ai_status = 'processing' AND deleted_at IS NULL`,
[title || '', status, row.id]
);
attempts.delete(row.id);