60 lines
3.9 KiB
TypeScript
60 lines
3.9 KiB
TypeScript
import { PrismaClient } from "./prisma/generated/client";
|
||
|
||
const prisma = new PrismaClient();
|
||
|
||
type SeedDifficulty = "HELLO_WORLD" | "COMPONENT" | "VIEW" | "EPIC";
|
||
|
||
const SEED_TASKS: Array<{
|
||
id: string;
|
||
title: string;
|
||
price: number;
|
||
difficulty: SeedDifficulty;
|
||
desc: string;
|
||
}> = [
|
||
{ id: "SW-01", title: "Hello VibeWork 標題元件", price: 100, difficulty: "HELLO_WORLD", desc: "在頁面渲染 <h1>Hello VibeWork</h1>" },
|
||
{ id: "SW-02", title: "單色「開始任務」按鈕", price: 100, difficulty: "HELLO_WORLD", desc: "按鈕文案「Start」與 bg-blue-500 text-white rounded-md px-4 py-2" },
|
||
{ id: "SW-03", title: "小字元件預留區(Badge)", price: 100, difficulty: "HELLO_WORLD", desc: "渲染圓角白底字元標籤,包含 text-sm" },
|
||
{ id: "SW-04", title: "靜態標籤列(3 個 chip)", price: 100, difficulty: "HELLO_WORLD", desc: "渲染 3 個 .chip 區塊,僅樣式與字串一致" },
|
||
{ id: "SW-05", title: "簡易 Footer", price: 100, difficulty: "HELLO_WORLD", desc: "包含「Copyright」與年份字串" },
|
||
{ id: "SW-06", title: "Hero 區塊(無互動)", price: 100, difficulty: "HELLO_WORLD", desc: "包含主標與副標,副標長度 > 15" },
|
||
{ id: "SW-07", title: "空白頁 + 預留插槽", price: 100, difficulty: "HELLO_WORLD", desc: "渲染空白卡片與「No data」提示" },
|
||
{ id: "SW-08", title: "單欄價格卡片", price: 500, difficulty: "COMPONENT", desc: "顯示 title / price / description,需有 3 列布局" },
|
||
{ id: "SW-09", title: "Login Primary Button 組件", price: 500, difficulty: "COMPONENT", desc: "包含「登入」字樣與 onClick prop 傳遞" },
|
||
{ id: "SW-10", title: "Secondary Button(outline 變體)", price: 500, difficulty: "COMPONENT", desc: "需有 variant prop,outline 時 border 不透明" },
|
||
{ id: "SW-11", title: "Alert Banner(success / error)", price: 500, difficulty: "COMPONENT", desc: "兩種 type 切換字體色與 icon class" },
|
||
{ id: "SW-12", title: "Modal Trigger(無邏輯)", price: 500, difficulty: "COMPONENT", desc: "可見觸發按鈕並渲染 Modal 區塊框" },
|
||
{ id: "SW-13", title: "輸入框 + 標籤組件", price: 500, difficulty: "COMPONENT", desc: "<label> 與 <input placeholder> 一一對應" },
|
||
{ id: "SW-14", title: "卡片列表(3 欄)", price: 500, difficulty: "COMPONENT", desc: "items 渲染為固定 3 張卡,含標題與小標" },
|
||
{ id: "SW-15", title: "導航列(desktop)", price: 500, difficulty: "COMPONENT", desc: "左側品牌、右側 3 個連結,含 active 狀態 class" },
|
||
{ id: "SW-16", title: "結帳摘要面板", price: 1000, difficulty: "VIEW", desc: "呈現 plan name / amount / tax / total,含灰階邊框" },
|
||
{ id: "SW-17", title: "靜態 KPI Dashboard", price: 1000, difficulty: "VIEW", desc: "3 張數據卡 + 1 張圓餅圖占位 SVG" },
|
||
{ id: "SW-18", title: "訂閱設定卡片區", price: 1000, difficulty: "VIEW", desc: "包含「月費/年費」切換 UI(僅 UI 不需真正切換)" },
|
||
{ id: "SW-19", title: "產品特性對照表", price: 1000, difficulty: "VIEW", desc: "3 行比較表(欄位固定)" },
|
||
{ id: "SW-20", title: "活躍通知列表頁", price: 1000, difficulty: "VIEW", desc: "渲染 4 列通知項目與「read/unread」狀態色" },
|
||
];
|
||
|
||
async function main() {
|
||
console.log("Seeding 20 official tasks...");
|
||
for (const t of SEED_TASKS) {
|
||
await prisma.task.create({
|
||
data: {
|
||
title: `[${t.id}] ${t.title}`,
|
||
description: t.desc,
|
||
status: "OPEN",
|
||
difficulty: t.difficulty,
|
||
scope_clarity_score: 0.95,
|
||
reward_amount: t.price,
|
||
reward_currency: "USD",
|
||
acceptance_criteria: {
|
||
validation_mode: "VITEST_UNIT",
|
||
test_file_content: "import { expect, test } from 'vitest'; test('it works', () => expect(1).toBe(1));"
|
||
},
|
||
required_stack: ["React", "TailwindCSS"],
|
||
}
|
||
});
|
||
}
|
||
console.log("Seeding complete!");
|
||
}
|
||
|
||
main().catch(console.error).finally(() => prisma.$disconnect());
|