Suspects: Spalte Mail und Löschen direkt in der Tabelle
- email als Symbol mit Adresse im Tooltip, Klick öffnet mailto: (Spalte per migrateColumns nachgezogen) - Löschen-Knopf am Zeilenende; Server erlaubt Löschen jetzt auch ohne vorheriges Archivieren Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6a452f1510
commit
78d6bef52c
@@ -13,7 +13,7 @@ import { logHistory } from '../history.js';
|
||||
const router = express.Router();
|
||||
router.use(requireAuth);
|
||||
|
||||
const TEXT_FIELDS = { name: 190, role: 190, company: 190, linkedin: 500, website: 500, notes: 5000 };
|
||||
const TEXT_FIELDS = { name: 190, role: 190, company: 190, email: 190, linkedin: 500, website: 500, notes: 5000 };
|
||||
|
||||
function readBody(body) {
|
||||
const out = {};
|
||||
@@ -26,6 +26,8 @@ function readBody(body) {
|
||||
for (const field of ['linkedin', 'website']) {
|
||||
if (out[field] && !/^https?:\/\//i.test(out[field])) out[field] = `https://${out[field]}`;
|
||||
}
|
||||
// "mailto:" aus kopierten Links entfernen - gespeichert wird die blanke Adresse.
|
||||
if (out.email) out.email = out.email.replace(/^mailto:/i, '');
|
||||
if (body.last_contact_on !== undefined) {
|
||||
out.last_contact_on = /^\d{4}-\d{2}-\d{2}$/.test(String(body.last_contact_on ?? ''))
|
||||
? body.last_contact_on
|
||||
@@ -152,14 +154,13 @@ router.post('/:id/acknowledge', async (req, res, next) => {
|
||||
}
|
||||
});
|
||||
|
||||
/** Endgueltig loeschen - nur aus dem Archiv, damit nichts aus Versehen verschwindet. */
|
||||
/** Endgueltig loeschen - aus der Tabelle wie aus dem Archiv (die Oberflaeche fragt nach). */
|
||||
router.delete('/:id', async (req, res, next) => {
|
||||
const id = Number(req.params.id);
|
||||
if (!Number.isInteger(id)) return res.status(400).json({ error: 'Ungültige Kennung.' });
|
||||
try {
|
||||
const [[row]] = await pool.query('SELECT name, archived FROM icon_suspects WHERE id = ?', [id]);
|
||||
const [[row]] = await pool.query('SELECT name FROM icon_suspects WHERE id = ?', [id]);
|
||||
if (!row) return res.status(404).json({ error: 'Suspect nicht gefunden.' });
|
||||
if (!row.archived) return res.status(409).json({ error: 'Bitte zuerst archivieren.' });
|
||||
await pool.query('DELETE FROM icon_suspects WHERE id = ?', [id]);
|
||||
await logHistory({
|
||||
entityType: 'system',
|
||||
|
||||
Reference in New Issue
Block a user