diff --git a/src/features/tech-log/adapters/http/http-public-content-gateway.ts b/src/features/tech-log/adapters/http/http-public-content-gateway.ts index 390c3f7..88a6e9b 100644 --- a/src/features/tech-log/adapters/http/http-public-content-gateway.ts +++ b/src/features/tech-log/adapters/http/http-public-content-gateway.ts @@ -142,6 +142,10 @@ export function createHttpPublicContentGateway( const canonicalPath = String(detail.canonicalPath ?? ""); const groups = (detail.relations as Readonly>) ?? {}; + const projectOf = (entry: Readonly<{ title?: string; path?: string }> | undefined) => + entry?.path + ? { name: entry.title ?? "", slug: entry.path.split("/").filter(Boolean).pop() ?? "", path: entry.path } + : undefined; if (kind === "CASE") { const body = (detail.case as Readonly>) ?? {}; @@ -254,7 +258,15 @@ export function createHttpPublicContentGateway( summary: body.summary as string, path: canonicalPath, primaryTopic: body.primaryTopic as never, - primaryProject: body.primaryProject as never, + /* + 질문 상세는 프로젝트를 `question` 이 아니라 `relations.primaryProject` 에 담는다 — + Case/Reference 와 다른 자리다. `question` 에서 찾고 있었으므로 머리말의 프로젝트 + 칸이 늘 비어 있었다. + + 그 자리의 값은 `RelatedEntry` 라 `title`/`path` 를 쓴다. 머리말이 기다리는 것은 + `name`/`slug` 이므로 여기서 옮겨 준다 — slug 는 경로의 마지막 마디다. + */ + primaryProject: projectOf(groups.primaryProject) as never, publishedAt: body.updatedAt as string, /* 계약이 주는 이름은 `resultCase` / `producedDecision` / `derivedReferences` 다. diff --git a/tests/features/tech-log/public-question-mapping.test.ts b/tests/features/tech-log/public-question-mapping.test.ts index c356841..621d678 100644 --- a/tests/features/tech-log/public-question-mapping.test.ts +++ b/tests/features/tech-log/public-question-mapping.test.ts @@ -84,6 +84,10 @@ test("a published Open Question maps its four point groups into the screen's fie assert.deepEqual([...record.unknowns], DETAIL.question.points.unknowns); assert.deepEqual([...record.constraints], DETAIL.question.points.constraints); assert.equal(record.nextValidation, DETAIL.question.nextVerification); + // 질문 상세는 프로젝트를 `relations` 에 담는다 — `question` 에서 찾으면 머리말의 프로젝트 + // 칸이 늘 비어 있다. + assert.equal(record.projectTitle, "KeyCloak Patterns"); + assert.equal(record.projectSlug, "keycloak-patterns"); }); /*