···185185 * NotFoundError if membership not found,
186186 * PdsWriteError on PDS failure.
187187 */
188188-export async function removeMemberAction(
188188+export async function deleteMemberAction(
189189 ctx: WikiRequestContext,
190190 memberDid: string,
191191): Promise<void> {
+10-15
src/server/db/queries/wiki.ts
···10101111export type WikiSort = "updated" | "created";
12121313+const WIKI_WITH_COUNTS = `
1414+ SELECT w.*, COUNT(n.slug) as note_count,
1515+ pc.handle as owner_handle, pc.avatar as owner_avatar
1616+ FROM wikis w
1717+ LEFT JOIN notes n ON n.wiki_slug = w.slug
1818+ LEFT JOIN profile_cache pc ON pc.did = w.did`;
1919+1320export function listPublicWikisPaginated(options: {
1421 query?: string;
1522 language?: string;
···44514552 const wikis = db
4653 .query(
4747- `SELECT w.*, COUNT(n.slug) as note_count,
4848- pc.handle as owner_handle, pc.avatar as owner_avatar
4949- FROM wikis w
5050- LEFT JOIN notes n ON n.wiki_slug = w.slug
5151- LEFT JOIN profile_cache pc ON pc.did = w.did
5454+ `${WIKI_WITH_COUNTS}
5255 WHERE ${where}
5356 GROUP BY w.slug
5457 ORDER BY ${orderCol} DESC
···8386 const db = getDb();
8487 return db
8588 .query(
8686- `SELECT w.*, COUNT(n.slug) as note_count,
8787- pc.handle as owner_handle, pc.avatar as owner_avatar
8888- FROM wikis w
8989- LEFT JOIN notes n ON n.wiki_slug = w.slug
9090- LEFT JOIN profile_cache pc ON pc.did = w.did
8989+ `${WIKI_WITH_COUNTS}
9190 WHERE w.did = ?
9291 GROUP BY w.slug
9392 ORDER BY w.updated_at DESC`,
···9998 const db = getDb();
10099 return db
101100 .query(
102102- `SELECT w.*, COUNT(n.slug) as note_count,
103103- pc.handle as owner_handle, pc.avatar as owner_avatar
104104- FROM wikis w
105105- LEFT JOIN notes n ON n.wiki_slug = w.slug
106106- LEFT JOIN profile_cache pc ON pc.did = w.did
101101+ `${WIKI_WITH_COUNTS}
107102 INNER JOIN memberships m ON m.wiki_slug = w.slug AND m.did = ?
108103 WHERE w.did != ?
109104 GROUP BY w.slug
···11-import { getDb } from "../../../../src/server/db/index.ts";
22-33-const db = getDb();
44-55-/** Clean up notes (and all dependent rows) matching a slug glob pattern in a wiki. */
66-export function cleanupNotes(wikiSlug: string, slugGlob: string): void {
77- const notes = db
88- .query(`SELECT at_uri FROM notes WHERE wiki_slug = ? AND slug GLOB ?`)
99- .all(wikiSlug, slugGlob) as { at_uri: string }[];
1010- for (const note of notes) {
1111- db.run("DELETE FROM current_note WHERE note_at_uri = ?", [note.at_uri]);
1212- db.run("DELETE FROM revisions WHERE note_at_uri = ?", [note.at_uri]);
1313- db.run("DELETE FROM backlinks WHERE source_note_uri = ?", [note.at_uri]);
1414- db.run("DELETE FROM snapshots WHERE note_at_uri = ?", [note.at_uri]);
1515- }
1616- db.run(`DELETE FROM notes WHERE wiki_slug = ? AND slug GLOB ?`, [
1717- wikiSlug,
1818- slugGlob,
1919- ]);
2020-}
+1-2
tests/server/db/queries/note.test.ts
···1313 searchNotes,
1414 upsertNote,
1515} from "../../../../src/server/db/queries/index.ts";
1616-import { ensureTestWiki } from "../../../helpers/cleanup.ts";
1717-import { cleanupNotes } from "./helpers.ts";
1616+import { cleanupNotes, ensureTestWiki } from "../../../helpers/cleanup.ts";
18171918const db = getDb();
2019const TEST_DID = "did:plc:mock123";
+1-2
tests/server/db/queries/revision.test.ts
···88 getSnapshots,
99 saveNoteEdit,
1010} from "../../../../src/server/db/queries/index.ts";
1111-import { ensureTestWiki } from "../../../helpers/cleanup.ts";
1212-import { cleanupNotes } from "./helpers.ts";
1111+import { cleanupNotes, ensureTestWiki } from "../../../helpers/cleanup.ts";
13121413const db = getDb();
1514const TEST_DID = "did:plc:mock123";