Update repo
This commit is contained in:
@@ -1,11 +1,40 @@
|
||||
import { defineSchema, defineTable } from "convex/server";
|
||||
import { v } from "convex/values";
|
||||
import { v, VId } from "convex/values";
|
||||
import { authTables } from '@convex-dev/auth/server';
|
||||
|
||||
const applicationTables = {
|
||||
questions: defineTable({
|
||||
question: v.string(),
|
||||
options: v.array(v.string()),
|
||||
correctAnswer: v.number(),
|
||||
topic: v.string(),
|
||||
difficulty: v.optional(v.string()),
|
||||
explanation: v.optional(v.string()),
|
||||
})
|
||||
.index('by_topic', ['topic']),
|
||||
|
||||
userProgress: defineTable({
|
||||
userId: v.id('users'),
|
||||
questionId: v.id('questions'),
|
||||
correctCount: v.number(),
|
||||
incorrectCount: v.number(),
|
||||
lastAttempted: v.number(),
|
||||
})
|
||||
.index('by_user', ['userId'])
|
||||
.index('by_user_and_question', ['userId', 'questionId']),
|
||||
|
||||
quizSessions: defineTable({
|
||||
userId: v.id('users'),
|
||||
activeQuestions: v.array(v.id('questions')),
|
||||
missedQuestions: v.array(v.id('questions')),
|
||||
completedQuestions: v.array(v.id('questions')),
|
||||
currentQuestionIndex: v.number(),
|
||||
isActive: v.boolean(),
|
||||
})
|
||||
.index('by_user_and_active', ['userId', 'isActive']),
|
||||
};
|
||||
|
||||
export default defineSchema({
|
||||
notes: defineTable({
|
||||
userId: v.string(),
|
||||
title: v.string(),
|
||||
content: v.string(),
|
||||
summary: v.optional(v.string()),
|
||||
}),
|
||||
...authTables,
|
||||
...applicationTables,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user