feat: read the profile's topics from Studio, and add working-copy deletion
Two things an author could not control from Studio. The profile's "주요 관심 주제" was four strings in the JSX. Creating or removing a topic in Studio changed nothing, and correcting the list meant a rebuild and a redeploy. It now renders the published topic list. The old literal opened with "Backend Architecture", which no record in the catalogue actually carries — the profile was advertising a topic that did not exist, and nothing could have caught that while the list lived in the markup. The working-copy list gained a delete control. It routes by kind because the contract and the storage both do: Case and Reference share one table split by type, Question is its own. Decision has no delete — its lifecycle is accept, reject, supersede, which records what happened rather than erasing it — so the control does not appear for it. The list summary carries no version, so deletion reads the working copy first and uses the version it finds. A stale version from a list left open should fail as a conflict, not delete whatever is there now.
This commit is contained in:
@@ -85,6 +85,19 @@ export function createHttpManagementGateway(
|
||||
run<PublishResponse>("publishRelease", { id, expectedVersion }),
|
||||
archiveRelease: (id: string, expectedVersion: number) =>
|
||||
run<ReleaseEditResponse>("archiveRelease", { id, expectedVersion }),
|
||||
deleteDocument: async (
|
||||
kind: "CASE" | "REFERENCE" | "QUESTION",
|
||||
id: string,
|
||||
expectedVersion: number,
|
||||
) => {
|
||||
const operationId =
|
||||
kind === "CASE"
|
||||
? "deleteCaseDraft"
|
||||
: kind === "REFERENCE"
|
||||
? "deleteReferenceDraft"
|
||||
: "deleteQuestion";
|
||||
await run<void>(operationId, { id, expectedVersion });
|
||||
},
|
||||
deleteProject: async (id: string, expectedVersion: number) => {
|
||||
await run<void>("deleteProject", { id, expectedVersion });
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
Project,
|
||||
PublicContentQueries,
|
||||
PublicRecord,
|
||||
PublicTopic,
|
||||
QuestionRecord,
|
||||
RecordFilters,
|
||||
RecordKind,
|
||||
@@ -292,6 +293,18 @@ export function createHttpPublicContentGateway(
|
||||
* one object with a named slot per kind rather than a list, because each slot
|
||||
* has its own shape; the order below is the order the screen renders them in.
|
||||
*/
|
||||
async function listTopics(): Promise<PublicTopic[]> {
|
||||
const page = await read<Page>("listPublicTopics", {});
|
||||
if (page === NOT_FOUND) return [];
|
||||
return (page.items ?? []).map((item) =>
|
||||
Object.freeze({
|
||||
name: String(item.name ?? ""),
|
||||
slug: String(item.slug ?? ""),
|
||||
recordCount: Number(item.recordCount ?? 0),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function getHomeFocusItems(): Promise<HomeFocusItem[]> {
|
||||
const home = await read<Readonly<{ focus?: Readonly<Record<string, never>> }>>(
|
||||
"getPublicHome",
|
||||
@@ -430,6 +443,7 @@ export function createHttpPublicContentGateway(
|
||||
getRecord,
|
||||
getProject,
|
||||
getRelease,
|
||||
listTopics,
|
||||
getProjectRecords,
|
||||
getProjectDecisions,
|
||||
getProjectActivity,
|
||||
|
||||
Reference in New Issue
Block a user