fix(api): delete notebooks with null slugs
This commit is contained in:
1 parent
23d1cc1ec9
commit
5dee03b2de
2 files changed
+3
-3
No files matched your search
@@ -239,9 +239,9 @@ describe("notebook identity", () => {
|
||||
const fixture = createFixture();
|
||||
try {
|
||||
fixture.sqlite.exec(`
|
||||
UPDATE notebooks SET name = '注册考试' WHERE id = 'nb_notes';
|
||||
UPDATE notebooks SET name = '注册考试', slug = NULL WHERE id = 'nb_notes';
|
||||
INSERT INTO notebooks (id, workspace_id, parent_id, name, slug, is_deleted, created_at, updated_at) VALUES
|
||||
('nb_law', 'ws_1', 'nb_notes', '法律法规', 'law', 0, '2026-09-10T00:00:00.000Z', '2026-09-10T00:00:00.000Z'),
|
||||
('nb_law', 'ws_1', 'nb_notes', '法律法规', NULL, 0, '2026-09-10T00:00:00.000Z', '2026-09-10T00:00:00.000Z'),
|
||||
('nb_history', 'ws_1', 'nb_notes', '建筑史', 'history', 0, '2026-09-10T00:00:00.000Z', '2026-09-10T00:00:00.000Z'),
|
||||
('nb_outline', 'ws_1', 'nb_history', '大纲', 'outline', 0, '2026-09-10T00:00:00.000Z', '2026-09-10T00:00:00.000Z');
|
||||
INSERT INTO memos (id, workspace_id, notebook_id, title, is_deleted, updated_at)
|
||||
|
||||
@@ -324,7 +324,7 @@ export const deleteNotebookRecord = async (
|
||||
`UPDATE notebooks
|
||||
SET is_deleted = 1, deleted_at = ?, updated_at = ?
|
||||
WHERE workspace_id = ? AND is_deleted = 0 AND id IN (${placeholders})
|
||||
AND slug <> 'inbox' AND id <> 'nb_inbox' AND id <> ?`
|
||||
AND (slug IS NULL OR slug <> 'inbox') AND id <> 'nb_inbox' AND id <> ?`
|
||||
).bind(now, now, workspaceId, ...chunk, inboxId);
|
||||
});
|
||||
statements.push(auditStatement(db, actor.actorType, actor.actorId, "notebook.delete", "notebook", id, {
|
||||
|
||||
Reference in new issue
Block a user