Blueprint UI — Build::BlueprintsController + 결과 뷰 + DB 스키마 시각화 + 비동기 Job + Turbo Stream + 테스트

ID: 2ffcc8d7-b187-4e7e-a3f9-2bd4772ec766

보통 리뷰

## 목표
Blueprint 결과 뷰 + 비동기 생성(Job + Turbo Stream). 기술 스택, DB 스키마 시각화, 페이지 목록, 개발 우선순위 표시.

## 현재 상태
- Build::BlueprintsController 스텁 (show, create)
- Ai::BlueprintGeneratorService 구현 완료
- Ai::AnalyzeIdeaJob 패턴 참고 가능
- 라우트: `resources :projects do resource :blueprint, only: [:show, :create] end`
- Project: tech_stack, tech_stack_reason, db_schema_draft(jsonb), pages_list(jsonb), dev_priority(jsonb)

## 구현 사항

### 1. Ai::GenerateBlueprintJob (IdeaAnalyzeJob과 동일 패턴)
```ruby
class Ai::GenerateBlueprintJob < ApplicationJob
queue_as :ai_processing
def perform(project_id)
project = Project.find(project_id)
Ai::BlueprintGeneratorService.new(project: project, user: project.user).call
Turbo::StreamsChannel.broadcast_update_to(
"project_#{project_id}", target: "blueprint_result",
partial: "build/blueprints/result", locals: { project: project }
)
rescue => e
Rails.logger.error("GenerateBlueprintJob failed: #{e.message}")
raise
end
end
```

### 2. Build::BlueprintsController
```ruby
class Build::BlueprintsController < ApplicationController
before_action :set_project
before_action :authorize_owner!

def show; end

def create
Ai::GenerateBlueprintJob.perform_later(@project.id)
redirect_to build_project_blueprint_path(@project), notice: "설계도 생성을 시작했습니다."
end

private
def set_project = @project = Project.find(params[:project_id])
def authorize_owner!
redirect_to build_projects_path, alert: I18n.t("errors.messages.not_authorized") unless @project.user == Current.user
end
end
```

### 3. 뷰
**build/blueprints/show.html.erb**:
- turbo_stream_from "project_#{@project.id}"
- 결과 있으면 _result 렌더, 없으면 "설계도 생성하기" 버튼
- id="blueprint_result" div

**build/blueprints/_result.html.erb**:
- **기술 스택 카드**: tech_stack + tech_stack_reason
- **DB 스키마 시각화**: db_schema_draft(jsonb) 테이블별 컬럼 표시 (테이블 형태)
- **페이지 목록**: pages_list 리스트
- **개발 우선순위**: dev_priority 순서 리스트
- **재생성 버튼**
- 다크 테마 (bg-bg, bg-surface, bg-accent)
- 기존 Partial 활용

### ⚠️ 주의
- build/blueprints/ + jobs/ 범위만 수정 (developer-1은 dashboard/ 작업 중)
- IdeaAnalysis 패턴과 일관성 유지
- Project 모델 건드리지 않기

### 테스트
- Build::BlueprintsController: show(인증, 소유자), create(Job 큐잉)
- Ai::GenerateBlueprintJob: perform(서비스 호출 mock)

### 완료 기준
- Blueprint 결과 페이지
- DB 스키마 시각적 표시
- 비동기 생성 + Turbo Stream 실시간 갱신
- bin/rails test 전체 통과

첨부 이미지

이미지 추가 (Ctrl+V로 붙여넣기 또는 클릭)

JPEG, PNG, GIF, WebP / 최대 10MB

담당자: developer-2
생성일: 2026년 03월 26일 10:15

활동 로그

  • D
    developer-2 상태 변경: 할 일 → 리뷰

    2026년 03월 26일 10:19:20