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 ad52569..24e315a 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 @@ -31,6 +31,7 @@ import { import { cardSummary } from "../../domain/content-format/card-summary.ts"; import type { components } from "../../contracts/public/generated.ts"; import type { StudioOperationExecutor } from "./http-studio-gateway.ts"; +import { projectStageLabel } from "../../domain/public/project-phase-labels.ts"; const ROUTE_ID = "TECH_LOG_PUBLIC"; @@ -576,7 +577,12 @@ export function createHttpPublicContentGateway( title: String(work.projectName ?? ""), summary: String(work.purpose ?? ""), details: Object.freeze([ - { label: "단계", value: String(work.phase ?? "") }, + /* + 단계는 저장하는 값(`DESIGN`)이지 방문자에게 할 말이 아니다. 홈의 「지금 집중하는 + 것」이 그 상수를 그대로 찍고 있었다 — 프로젝트 화면은 같은 값을 「설계」로 부르고 + 있어서, 한 사이트가 같은 것을 두 이름으로 말했다. + */ + { label: "단계", value: projectStageLabel(String(work.phase ?? "")) }, { label: "현재 목표", value: String(work.currentObjective ?? "") }, { label: "다음 작업", value: String(work.nextStep ?? "") }, ]), diff --git a/src/features/tech-log/adapters/static/public-query.ts b/src/features/tech-log/adapters/static/public-query.ts index 047a37a..43c2c2e 100644 --- a/src/features/tech-log/adapters/static/public-query.ts +++ b/src/features/tech-log/adapters/static/public-query.ts @@ -10,6 +10,7 @@ import { type Release, type HomeFocusItem, } from "./public-content.ts"; +import { projectStageLabel } from "../../domain/public/project-phase-labels.ts"; import type { LatestRecordEntry, PublicContentQueries, @@ -257,7 +258,7 @@ export function getHomeFocusItems(): HomeFocusItem[] { title: project.title, summary: project.summary, details: [ - { label: "단계", value: project.stage }, + { label: "단계", value: projectStageLabel(project.stage) }, { label: "현재 목표", value: project.currentGoal }, { label: "다음 작업", value: project.nextStep }, ], diff --git a/src/features/tech-log/application/ports/public-content-queries.ts b/src/features/tech-log/application/ports/public-content-queries.ts index 020d26f..9d1a4b6 100644 --- a/src/features/tech-log/application/ports/public-content-queries.ts +++ b/src/features/tech-log/application/ports/public-content-queries.ts @@ -1,3 +1,5 @@ +import type { PublicProjectStage } from "../../domain/public/project-phase-labels.ts"; + /* 화면이 다루는 기록 종류. Studio 계약의 `RecordKind` 와 같은 집합이어야 한다 — 다만 결정은 자기 상세 화면이 없어 여기 없다. @@ -215,7 +217,8 @@ export type Project = { title: string; summary: string; thesis: string; - stage: "DESIGN" | "VALIDATION"; + /* 이름표는 도메인이 갖는다. 같은 집합을 두 곳에 적으면 한쪽만 늘어난다. */ + stage: PublicProjectStage; currentGoal: string; nextStep: string; /* diff --git a/src/features/tech-log/presentation/shared/project-phase-labels.ts b/src/features/tech-log/domain/public/project-phase-labels.ts similarity index 68% rename from src/features/tech-log/presentation/shared/project-phase-labels.ts rename to src/features/tech-log/domain/public/project-phase-labels.ts index 187cf5c..fac9a3a 100644 --- a/src/features/tech-log/presentation/shared/project-phase-labels.ts +++ b/src/features/tech-log/domain/public/project-phase-labels.ts @@ -1,4 +1,8 @@ -import type { Project } from "../../application/ports/public-content-queries.ts"; +/** + * 공개 조회가 접어서 주는 단계. 포트가 같은 집합을 쓰며(`Project["stage"]`), 어긋나면 + * `projectStageLabel` 을 부르는 화면에서 타입 검사가 잡는다. + */ +export type PublicProjectStage = "DESIGN" | "VALIDATION"; /** * 프로젝트가 지금 어디까지 왔는지를 사람에게 보여 주는 이름. @@ -23,15 +27,15 @@ export const PROJECT_PHASE_LABELS: Record = { /** * 공개 조회가 접어서 주는 단계. * - *

`Record` 이므로 계약이 값을 늘리면 여기가 비어 있는 것을 - * 컴파일러가 잡는다. + *

`Record` 이므로 값이 늘면 여기가 비어 있는 것을 컴파일러가 + * 잡는다. */ -export const PROJECT_STAGE_LABELS: Record = { +export const PROJECT_STAGE_LABELS: Record = { DESIGN: "설계", VALIDATION: "검증", }; /** 모르는 값이 오면 원문을 그대로 보여 준다 — 빈 칸보다 낫고, 무엇이 빠졌는지도 드러난다. */ export function projectStageLabel(stage: string): string { - return PROJECT_STAGE_LABELS[stage as Project["stage"]] ?? PROJECT_PHASE_LABELS[stage] ?? stage; + return PROJECT_STAGE_LABELS[stage as PublicProjectStage] ?? PROJECT_PHASE_LABELS[stage] ?? stage; } diff --git a/src/features/tech-log/presentation/public/pages/profile-page.tsx b/src/features/tech-log/presentation/public/pages/profile-page.tsx index 71fe346..cc61352 100644 --- a/src/features/tech-log/presentation/public/pages/profile-page.tsx +++ b/src/features/tech-log/presentation/public/pages/profile-page.tsx @@ -1,5 +1,5 @@ import { Link } from "react-router-dom"; -import { projectStageLabel } from "../../shared/project-phase-labels.ts"; +import { projectStageLabel } from "../../../domain/public/project-phase-labels.ts"; import { TECH_LOG_FEATURE_ID } from "../../../application/tech-log-feature-input.ts"; import { publicSiteConfig } from "../../../contracts/public-site-config.ts"; diff --git a/src/features/tech-log/presentation/public/pages/project-overview-page.tsx b/src/features/tech-log/presentation/public/pages/project-overview-page.tsx index b9f4984..2c9623a 100644 --- a/src/features/tech-log/presentation/public/pages/project-overview-page.tsx +++ b/src/features/tech-log/presentation/public/pages/project-overview-page.tsx @@ -1,5 +1,5 @@ import { Link } from "react-router-dom"; -import { projectStageLabel } from "../../shared/project-phase-labels.ts"; +import { projectStageLabel } from "../../../domain/public/project-phase-labels.ts"; import { RegisteredNotFoundRoute, diff --git a/src/features/tech-log/presentation/public/pages/projects-page.tsx b/src/features/tech-log/presentation/public/pages/projects-page.tsx index 4c2af0e..d615b16 100644 --- a/src/features/tech-log/presentation/public/pages/projects-page.tsx +++ b/src/features/tech-log/presentation/public/pages/projects-page.tsx @@ -1,5 +1,5 @@ import { Link } from "react-router-dom"; -import { projectStageLabel } from "../../shared/project-phase-labels.ts"; +import { projectStageLabel } from "../../../domain/public/project-phase-labels.ts"; import { usePublicContent } from "../use-public-content.tsx"; diff --git a/src/features/tech-log/presentation/studio/components/project-editor.tsx b/src/features/tech-log/presentation/studio/components/project-editor.tsx index 73096a9..081668e 100644 --- a/src/features/tech-log/presentation/studio/components/project-editor.tsx +++ b/src/features/tech-log/presentation/studio/components/project-editor.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState, type FormEvent } from "react"; -import { PROJECT_PHASE_LABELS } from "../../shared/project-phase-labels.ts"; +import { PROJECT_PHASE_LABELS } from "../../../domain/public/project-phase-labels.ts"; import type { components } from "../../../contracts/studio/generated.ts"; import type { diff --git a/src/features/tech-log/presentation/studio/components/taxonomy-manager.tsx b/src/features/tech-log/presentation/studio/components/taxonomy-manager.tsx index cacd3bd..7167a79 100644 --- a/src/features/tech-log/presentation/studio/components/taxonomy-manager.tsx +++ b/src/features/tech-log/presentation/studio/components/taxonomy-manager.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState, type FormEvent } from "react"; -import { PROJECT_PHASE_LABELS } from "../../shared/project-phase-labels.ts"; +import { PROJECT_PHASE_LABELS } from "../../../domain/public/project-phase-labels.ts"; import { DestructiveConfirmDialog } from "./destructive-confirm-dialog.tsx"; import type { ProjectIndexItem, TopicEdit } from "../../../contracts/management/contract.ts"; diff --git a/tests/features/tech-log/public-query.test.ts b/tests/features/tech-log/public-query.test.ts index 4ff0cc9..3ddc96d 100644 --- a/tests/features/tech-log/public-query.test.ts +++ b/tests/features/tech-log/public-query.test.ts @@ -250,7 +250,8 @@ test("derives public home focus and Case verification labels from canonical cont summary: "저장소·Redis·JPA·MongoDB 같은 기술을 붙일 때 애플리케이션 경계를 다시 만들지 않도록 공통 계약을 정리하는 프로젝트입니다.", details: [ - { label: "단계", value: "DESIGN" }, + // 단계는 저장하는 값이지 방문자에게 할 말이 아니다 — 프로젝트 화면과 같은 이름을 쓴다. + { label: "단계", value: "설계" }, { label: "현재 목표", value: "Filesystem과 Object Storage를 하나의 StoragePort로 통합",