Add checkup review flags, duplicate detection, and corrected painting images.

Introduce checkup_checked/checkup_fixed on paintings with Checkup page filters and API. Fixed paintings auto-mark as reviewed. Add find-duplicates tooling and document debug/checkup workflow. Include Botticelli and Michelangelo image fixes from checkup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Danila Khodjaef
2026-06-20 20:45:55 +03:00
co-authored by Cursor
parent 4683089495
commit 4c6acd5a3a
55 changed files with 750 additions and 39 deletions
+36
View File
@@ -0,0 +1,36 @@
require('dotenv').config();
const pool = require('../server/db');
async function main() {
const { rows } = await pool.query(`
WITH dups AS (
SELECT artist_id, title, year, array_agg(id ORDER BY id) AS ids
FROM paintings
GROUP BY artist_id, title, year
HAVING COUNT(*) > 1
),
expanded AS (
SELECT artist_id, title, year, ids[1] AS keep_id, unnest(ids[2:]) AS drop_id
FROM dups
)
SELECT e.drop_id,
(SELECT COUNT(*) FROM painting_influences pi
WHERE pi.painting_id = e.drop_id OR pi.influenced_by_painting_id = e.drop_id) AS legacy_links,
(SELECT COUNT(*) FROM painting_influence_sources pis
WHERE pis.painting_id = e.drop_id OR pis.source_painting_id = e.drop_id) AS source_links
FROM expanded e
ORDER BY e.drop_id
`);
const withLinks = rows.filter((r) => Number(r.legacy_links) + Number(r.source_links) > 0);
console.log(`Exact-duplicate drop candidates: ${rows.length}`);
console.log(`With influence links (need merge before delete): ${withLinks.length}`);
if (withLinks.length) console.table(withLinks);
await pool.end();
}
main().catch((err) => {
console.error(err);
process.exit(1);
});