Add page data delivery and publication guards

This commit is contained in:
john
2026-07-08 21:10:47 +08:00
parent 8d629e7a4e
commit eea14c1855
66 changed files with 3035 additions and 413 deletions
+8 -4
View File
@@ -670,9 +670,13 @@ export function createPageService(pool, options = {}) {
AND JSON_UNQUOTE(JSON_EXTRACT(pv.source_snapshot_json, '$.relative_path')) = ?
)
)
ORDER BY p.updated_at DESC, p.id DESC
ORDER BY
CASE WHEN p.workspace_relative_path = ? THEN 0 ELSE 1 END,
CASE WHEN pr.id IS NOT NULL THEN 0 ELSE 1 END,
p.updated_at DESC,
p.id DESC
LIMIT 1`,
[userId, normalized, normalized],
[userId, normalized, normalized, normalized],
);
return rows[0] ? pageResponse(rows[0]) : null;
};
@@ -1481,8 +1485,8 @@ export function createPageService(pool, options = {}) {
},
}),
createPage: (userId, input) => createVersion(userId, input, { type: 'template' }),
updatePage: (userId, pageId, input) =>
createVersion(userId, { ...input, pageId }, { type: 'generated' }),
updatePage: (userId, pageId, input, source = {}) =>
createVersion(userId, { ...input, pageId }, { type: 'generated', ...source }),
localizePrivateResources,
redactPage,
createRedactedCopy: redactPage,