Skip to content

Commit e9d0dd1

Browse files
authored
Merge branch 'main' into feat/test
2 parents 3011d5f + 8819270 commit e9d0dd1

12 files changed

Lines changed: 1169 additions & 12 deletions

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Built with React, powered by Google's Gemini AI, and featuring a stunning glassm
2121
- 📊 **Detailed Analytics** - Comprehensive score reports with explanations
2222
- 🎨 **Glassmorphic UI** - Modern, beautiful design with smooth animations
2323
- 📱 **Responsive Design** - Works seamlessly on desktop, tablet, and mobile
24-
- 🌐 **Open Source** - Free forever, built for the community
24+
- 🌐 **Open Source** - Free forever, built for the community.
25+
- 📌 **Bookmark** - Bookmark questions that you want to revise later.
2526

2627
---
2728

database-setup.sql

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,31 @@ CREATE TABLE IF NOT EXISTS public.quiz_history (
2525
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
2626
);
2727

28+
-- Create bookmarked_questions table to store user's saved questions
29+
CREATE TABLE IF NOT EXISTS public.bookmarked_questions (
30+
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
31+
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE NOT NULL,
32+
question TEXT NOT NULL,
33+
options JSONB NOT NULL, -- array of answer options
34+
correct_answer TEXT NOT NULL,
35+
explanation TEXT,
36+
category TEXT NOT NULL,
37+
difficulty TEXT NOT NULL,
38+
notes TEXT, -- user's personal notes about the question
39+
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
40+
-- Ensure uniqueness: same user cannot bookmark the same question twice
41+
UNIQUE(user_id, question, correct_answer)
42+
);
43+
2844
-- Enable RLS on profiles table
2945
ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY;
3046

3147
-- Enable RLS on quiz_history table
3248
ALTER TABLE public.quiz_history ENABLE ROW LEVEL SECURITY;
3349

50+
-- Enable RLS on bookmarked_questions table
51+
ALTER TABLE public.bookmarked_questions ENABLE ROW LEVEL SECURITY;
52+
3453
-- Create policies for profiles table
3554
CREATE POLICY "Users can view own profile" ON public.profiles
3655
FOR SELECT USING (auth.uid() = id);
@@ -48,6 +67,19 @@ CREATE POLICY "Users can view own quiz history" ON public.quiz_history
4867
CREATE POLICY "Users can insert own quiz history" ON public.quiz_history
4968
FOR INSERT WITH CHECK (auth.uid() = user_id);
5069

70+
-- Create policies for bookmarked_questions table
71+
CREATE POLICY "Users can view own bookmarks" ON public.bookmarked_questions
72+
FOR SELECT USING (auth.uid() = user_id);
73+
74+
CREATE POLICY "Users can insert own bookmarks" ON public.bookmarked_questions
75+
FOR INSERT WITH CHECK (auth.uid() = user_id);
76+
77+
CREATE POLICY "Users can update own bookmarks" ON public.bookmarked_questions
78+
FOR UPDATE USING (auth.uid() = user_id);
79+
80+
CREATE POLICY "Users can delete own bookmarks" ON public.bookmarked_questions
81+
FOR DELETE USING (auth.uid() = user_id);
82+
5183
-- Create function to automatically create profile on user signup
5284
CREATE OR REPLACE FUNCTION public.handle_new_user()
5385
RETURNS TRIGGER AS $$
@@ -68,3 +100,8 @@ CREATE TRIGGER on_auth_user_created
68100
CREATE INDEX IF NOT EXISTS idx_quiz_history_user_id ON public.quiz_history(user_id);
69101
CREATE INDEX IF NOT EXISTS idx_quiz_history_created_at ON public.quiz_history(created_at DESC);
70102
CREATE INDEX IF NOT EXISTS idx_quiz_history_category ON public.quiz_history(category);
103+
104+
-- Create indexes for bookmarked_questions
105+
CREATE INDEX IF NOT EXISTS idx_bookmarked_questions_user_id ON public.bookmarked_questions(user_id);
106+
CREATE INDEX IF NOT EXISTS idx_bookmarked_questions_created_at ON public.bookmarked_questions(created_at DESC);
107+
CREATE INDEX IF NOT EXISTS idx_bookmarked_questions_category ON public.bookmarked_questions(category);

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/brain.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<link rel="stylesheet" href="/dist/assets/index-CfhMXp5D.css ">
7+
<link rel="stylesheet" href="/dist/assets/index.es-DGCo5Oyp.js ">
88

99
<title>Inquizzitive</title>
1010
<!-- Og tags -->

package-lock.json

Lines changed: 244 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)