Skip to content

Commit c1188c6

Browse files
committed
Resolve code smells and remove bad code from backend
Signed-off-by: SeeuSim <[email protected]>
1 parent 130a23f commit c1188c6

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Router } from 'express';
2+
3+
import {
4+
searchQuestionsByTitle,
5+
getQuestions,
6+
getQuestionDetails,
7+
getRandomQuestion,
8+
} from '@/controller/question-controller';
9+
10+
const router = Router();
11+
12+
router.get('/search', searchQuestionsByTitle);
13+
14+
router.get('/', getQuestions);
15+
16+
router.get('/:questionId', getQuestionDetails);
17+
18+
router.post('/random', getRandomQuestion);
19+
20+
export default router;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CREATE TABLE IF NOT EXISTS "users" (
2+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"email" varchar(255) NOT NULL,
4+
"username" varchar(255) NOT NULL,
5+
"first_name" varchar(255) NOT NULL,
6+
"last_name" varchar(255) NOT NULL,
7+
"password" varchar(255) NOT NULL,
8+
"failed_attempts" smallint DEFAULT 0,
9+
"unlock_time" timestamp (6) with time zone,
10+
"attempted_questions" integer[],
11+
CONSTRAINT "users_email_unique" UNIQUE("email"),
12+
CONSTRAINT "users_username_unique" UNIQUE("username")
13+
);

frontend/src/routes/home/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Navigate } from 'react-router-dom';
2+
import { ROUTES } from '@/lib/routes';
3+
4+
export const HomePage = () => {
5+
// TODO: Add actual home page
6+
return <Navigate to={ROUTES.QUESTIONS} />;
7+
};

0 commit comments

Comments
 (0)