feat: version 2.7.2 -- tarjetas con icono en Contraseñas + fix borrado de password al editar

Listado de Contraseñas pasa de tabla a tarjetas: icono elegible (
catalogo fijo, sin servicios externos de favicon por privacidad) o
inicial del nombre como fallback, junto con nombre y enlace.

Fix real: editar una credencial sin revelar la contraseña antes la
dejaba vacia al guardar -- ahora se conserva la que ya estaba si no
se escribe una nueva.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Milton Gonzalez
2026-10-01 12:41:22 -05:00
parent 28e339f19a
commit 127ca2ba7e
11 changed files with 161 additions and 36 deletions
+8 -8
View File
@@ -1,6 +1,6 @@
import { pool } from '../../config/db.js';
const LIST_SELECT = 'id, user_id, title, url, username, created_at, updated_at';
const LIST_SELECT = 'id, user_id, title, url, username, icon_key, created_at, updated_at';
const FULL_SELECT = `${LIST_SELECT}, password_enc, notes_enc`;
export async function findByUser(userId) {
@@ -16,19 +16,19 @@ export async function findById(id) {
return rows[0] || null;
}
export async function create(userId, { title, url, username, passwordEnc, notesEnc }) {
export async function create(userId, { title, url, username, passwordEnc, notesEnc, iconKey }) {
const [result] = await pool.query(
`INSERT INTO vault_entries (user_id, title, url, username, password_enc, notes_enc)
VALUES (?, ?, ?, ?, ?, ?)`,
[userId, title, url || null, username || null, passwordEnc || null, notesEnc || null]
`INSERT INTO vault_entries (user_id, title, url, username, password_enc, notes_enc, icon_key)
VALUES (?, ?, ?, ?, ?, ?, ?)`,
[userId, title, url || null, username || null, passwordEnc || null, notesEnc || null, iconKey || null]
);
return findById(result.insertId);
}
export async function update(id, { title, url, username, passwordEnc, notesEnc }) {
export async function update(id, { title, url, username, passwordEnc, notesEnc, iconKey }) {
await pool.query(
`UPDATE vault_entries SET title = ?, url = ?, username = ?, password_enc = ?, notes_enc = ? WHERE id = ?`,
[title, url || null, username || null, passwordEnc || null, notesEnc || null, id]
`UPDATE vault_entries SET title = ?, url = ?, username = ?, password_enc = ?, notes_enc = ?, icon_key = ? WHERE id = ?`,
[title, url || null, username || null, passwordEnc || null, notesEnc || null, iconKey || null, id]
);
return findById(id);
}