File tree Expand file tree Collapse file tree 2 files changed +78
-0
lines changed
Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 1+ // TODO CHAPTER 4: Implement flashcard server handler
2+ //
3+ // This file should:
4+ // 1. Define FlashcardData type schema
5+ // 2. Create document handler for flashcard artifacts
6+ // 3. Handle creation and updates of flashcard quizzes
7+ //
8+ // See CHAPTER-4.md for the complete implementation.
9+
10+ import { z } from "zod" ;
11+
12+ /**
13+ * Schema for flashcard quiz data
14+ */
15+ export const flashcardSchema = z . object ( {
16+ topic : z . string ( ) ,
17+ questions : z . array (
18+ z . object ( {
19+ question : z . string ( ) ,
20+ options : z . array ( z . string ( ) ) . length ( 4 ) ,
21+ correctAnswer : z . number ( ) . min ( 0 ) . max ( 3 ) ,
22+ explanation : z . string ( ) ,
23+ } )
24+ ) ,
25+ } ) ;
26+
27+ export type FlashcardData = z . infer < typeof flashcardSchema > ;
28+
29+ // TODO: Add createDocumentHandler for flashcard artifacts
30+ // export const flashcardDocumentHandler = createDocumentHandler<"flashcard">({
31+ // kind: "flashcard",
32+ // onCreateDocument: async ({ title, dataStream }) => { ... },
33+ // onUpdateDocument: async ({ document, description, dataStream }) => { ... },
34+ // });
Original file line number Diff line number Diff line change 1+ // TODO CHAPTER 4: Implement study-plan server handler
2+ //
3+ // This file should:
4+ // 1. Define StudyPlanData type schema
5+ // 2. Create document handler for study-plan artifacts
6+ // 3. Handle creation and updates with progress tracking
7+ //
8+ // See CHAPTER-4.md for the complete implementation.
9+
10+ import { z } from "zod" ;
11+
12+ /**
13+ * Schema for study plan data
14+ */
15+ export const studyPlanSchema = z . object ( {
16+ topic : z . string ( ) ,
17+ duration : z . string ( ) ,
18+ overview : z . string ( ) ,
19+ weeks : z . array (
20+ z . object ( {
21+ week : z . number ( ) ,
22+ title : z . string ( ) ,
23+ goals : z . array ( z . string ( ) ) ,
24+ tasks : z . array (
25+ z . object ( {
26+ task : z . string ( ) ,
27+ duration : z . string ( ) ,
28+ completed : z . boolean ( ) . default ( false ) ,
29+ } )
30+ ) ,
31+ resources : z . array ( z . string ( ) ) ,
32+ } )
33+ ) ,
34+ tips : z . array ( z . string ( ) ) ,
35+ } ) ;
36+
37+ export type StudyPlanData = z . infer < typeof studyPlanSchema > ;
38+
39+ // TODO: Add createDocumentHandler for study-plan artifacts
40+ // export const studyPlanDocumentHandler = createDocumentHandler<"study-plan">({
41+ // kind: "study-plan",
42+ // onCreateDocument: async ({ title, dataStream }) => { ... },
43+ // onUpdateDocument: async ({ document, description, dataStream }) => { ... },
44+ // });
You can’t perform that action at this time.
0 commit comments