Add debug Remove entry, Show more auto-picker, and update docs.
DELETE /api/paintings/:id removes works and image files with gallery refresh and catalog navigation; Show more opens the search modal on load; documentation updated for migrate schema and debug workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
b2cae284ac
commit
f542c689c9
@@ -189,6 +189,30 @@ function unlinkPortraitFiles(row, safeBase) {
|
||||
}
|
||||
}
|
||||
|
||||
async function deletePainting(paintingId) {
|
||||
const result = await pool.query(
|
||||
`SELECT p.id, p.title, p.image_path, p.thumbnail_path, p.artist_id, a.name AS artist_name
|
||||
FROM paintings p
|
||||
JOIN artists a ON a.id = p.artist_id
|
||||
WHERE p.id = $1`,
|
||||
[paintingId]
|
||||
);
|
||||
if (result.rows.length === 0) {
|
||||
throw new Error('Painting not found');
|
||||
}
|
||||
|
||||
const row = result.rows[0];
|
||||
const safeBase = safePaintingBase(row.artist_name, row.title);
|
||||
unlinkPaintingFiles(row, safeBase);
|
||||
|
||||
inflight.delete(`${paintingId}:thumb`);
|
||||
inflight.delete(`${paintingId}:full`);
|
||||
|
||||
await pool.query(`DELETE FROM paintings WHERE id = $1`, [paintingId]);
|
||||
|
||||
return { id: row.id, artistId: row.artist_id, title: row.title };
|
||||
}
|
||||
|
||||
async function clearPaintingImage(paintingId) {
|
||||
const result = await pool.query(
|
||||
`SELECT p.id, p.title, p.image_path, p.thumbnail_path, a.name AS artist_name
|
||||
@@ -436,6 +460,7 @@ module.exports = {
|
||||
replacePaintingImageFromUrl,
|
||||
replaceArtistPortraitFromUrl,
|
||||
clearPaintingImage,
|
||||
deletePainting,
|
||||
clearArtistPortrait,
|
||||
replacePaintingImageFromBuffer,
|
||||
replaceArtistPortraitFromBuffer,
|
||||
|
||||
Reference in New Issue
Block a user