feat(survey): lib/survey/types — SurveyStep, SurveyResponse, SavedProgress

7 질문 step 정의 + 응답 객체 타입. survey_responses 테이블과 1:1 대응.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 05:18:18 +09:00
parent 7fbfff7f54
commit 824d2cd1ea

51
lib/survey/types.ts Normal file
View File

@@ -0,0 +1,51 @@
/**
* CONTOUR 설문 타입.
* survey_responses 테이블 스키마와 1:1 대응.
*/
export type SurveyStep =
| 'intro'
| 'q1'
| 'q2'
| 'q3'
| 'q4'
| 'q5'
| 'q6'
| 'q7'
| 'thanks';
export const QUESTION_STEPS: SurveyStep[] = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7'];
export const TOTAL_QUESTIONS = QUESTION_STEPS.length; // 7
export interface SurveyResponse {
// Q1
age_range?: string;
status?: string;
// Q2
awareness_freq?: string;
// Q3
tools_used?: string[];
tools_other?: string;
// Q4
cost_range?: string;
// Q5
best_tool?: string;
best_satisfy?: number;
// Q6
free_opinion?: string;
// Q7
email?: string;
// 메타 (제출 시 자동 채워짐)
user_agent?: string;
referrer?: string;
utm_source?: string;
utm_medium?: string;
utm_campaign?: string;
completion_seconds?: number;
}
export interface SavedProgress {
step: SurveyStep;
response: SurveyResponse;
startedAt: number; // ms epoch
}