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
+16
View File
@@ -54,6 +54,12 @@
.note-card-time { font-size: .72rem; color: var(--muted); }
.note-card-actions { display: flex; gap: 6px; }
.note-card-actions button { font-size: .78rem; }
.notes-toolbar { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.notes-toolbar > div > label[for="notesDeleted"] { font-size: .82rem; font-weight: 600; color: var(--muted); }
.note-card--deleted { opacity: .7; }
.note-card--deleted:hover { opacity: 1; }
.note-card--deleted .note-card-title { text-decoration: line-through; }
.note-del-badge { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(220,38,38,.1); color: #b91c1c; border: 1px solid rgba(220,38,38,.2); }
.note-empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: .9rem; border: 1px dashed var(--border); border-radius: 12px; }
.note-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-modal-head h3 { margin: 0; font-size: 1.05rem; }
@@ -70,6 +76,16 @@
<p class="page-sub">Личные заметки для каждого пользователя</p>
<button type="button" class="btn-primary" id="notesNewBtn"><i data-lucide="plus"></i> Новая заметка</button>
</div>
<div class="notes-toolbar">
<div>
<label for="notesDeleted">Удалённые</label>
<label class="toggle" style="padding:4px 6px">
<input type="checkbox" id="notesDeleted">
<span class="toggle-track"><span class="toggle-thumb"></span></span>
<span class="toggle-text"><small>Показать корзину</small></span>
</label>
</div>
</div>
<div id="notesList" class="notes-list"></div>
</div>
</div>