Update summary query mock to match combined vertical IS NULL OR NTS_AEO query
The /summary endpoint now uses a single query instead of two-step fallback. Update the test mock to match the new SQL pattern while keeping legacy patterns as fallback for compatibility.
This commit is contained in:
@@ -420,6 +420,24 @@ function installReadEndpointHandler(uploads, items) {
|
||||
},
|
||||
|
||||
// ----- /summary primary upload selection -----
|
||||
// Fixed: WHERE vertical IS NULL OR vertical = 'NTS_AEO' ORDER BY id DESC LIMIT 1
|
||||
{
|
||||
match: /WHERE\s+vertical\s+IS\s+NULL\s+OR\s+vertical\s*=\s*'NTS_AEO'\s+ORDER\s+BY\s+id\s+DESC\s+LIMIT\s+1/i,
|
||||
rows: () => {
|
||||
const candidates = uploads
|
||||
.filter(u => (u.vertical == null || u.vertical === 'NTS_AEO') && u.summary_json)
|
||||
.sort((a, b) => b.id - a.id);
|
||||
if (candidates.length === 0) return [];
|
||||
const u = candidates[0];
|
||||
return [{
|
||||
id: u.id,
|
||||
summary_json: u.summary_json,
|
||||
report_date: u.report_date,
|
||||
uploaded_at: u.uploaded_at,
|
||||
}];
|
||||
},
|
||||
},
|
||||
// Legacy mock (kept for backward-compat if query reverts):
|
||||
// Unfixed: WHERE vertical IS NULL ORDER BY id DESC LIMIT 1
|
||||
{
|
||||
match: /WHERE\s+vertical\s+IS\s+NULL\s+ORDER\s+BY\s+id\s+DESC\s+LIMIT\s+1/i,
|
||||
|
||||
Reference in New Issue
Block a user