diff --git a/.github/workflows/deployVercel.yml b/.github/workflows/deployVercel.yml index a1959f8..b09052a 100644 --- a/.github/workflows/deployVercel.yml +++ b/.github/workflows/deployVercel.yml @@ -2,7 +2,7 @@ name: Deploy to Vercel on: push: - branches: ['serviceRoleKey'] + branches: ['quiz_logic_origin'] jobs: diff --git a/src/routes/goals.ts b/src/routes/goals.ts index 58b0b5b..ced12b3 100644 --- a/src/routes/goals.ts +++ b/src/routes/goals.ts @@ -151,7 +151,8 @@ router.post('/update-quiz-selected', async (req, res) => { const newUserGoals = goalsToCreate.map(goalId => ({ user_id: userId, goal_id: goalId, - status: 'focused' + status: 'focused', + focus_origin: 'quiz' })); const { error: insertError } = await supabase diff --git a/src/routes/users.ts b/src/routes/users.ts index 1cc0929..81fe6e6 100644 --- a/src/routes/users.ts +++ b/src/routes/users.ts @@ -100,48 +100,4 @@ router.delete('/:id', serviceRoleMiddleware, async (req: Request, res: Response) } }); -// // Create user -// router.post('/', async (req, res) => { -// try { -// const { data, error } = await supabase -// .from('users') -// .insert([req.body]) -// .select(); -// if (error) throw new Error(error.message); -// res.status(201).json(data[0]); -// } catch (error: unknown) { -// res.status(500).json({ error: error instanceof Error ? error.message : 'An unknown error occurred' }); -// } -// }); - -// // Update user -// router.put('/:id', async (req, res) => { -// try { -// const { data, error } = await supabase -// .from('users') -// .update(req.body) -// .eq('id', req.params.id) -// .select(); -// if (error) throw new Error(error.message); -// if (data.length === 0) return res.status(404).json({ error: 'User not found' }); -// res.json(data[0]); -// } catch (error: unknown) { -// res.status(500).json({ error: error instanceof Error ? error.message : 'An unknown error occurred' }); -// } -// }); - -// // Delete user -// router.delete('/:id', async (req, res) => { -// try { -// const { error } = await supabase -// .from('users') -// .delete() -// .eq('id', req.params.id); -// if (error) throw new Error(error.message); -// res.status(204).send(); -// } catch (error: unknown) { -// res.status(500).json({ error: error instanceof Error ? error.message : 'An unknown error occurred' }); -// } -// }); - export default router; \ No newline at end of file diff --git a/tests/quiz.http b/tests/quiz.http index 2b0c80d..c38b31e 100644 --- a/tests/quiz.http +++ b/tests/quiz.http @@ -59,3 +59,69 @@ Content-Type: application/json ### Delete answer DELETE http://localhost:3000/quiz/answers/1 + + +### REMOTE ### + +### Questions Endpoints ### + +### Get all questions with their answers +GET https://nisa-invest-tfb-be.vercel.app/quiz/questions-with-answers + +### Get all questions +GET https://nisa-invest-tfb-be.vercel.app/quiz/questions + +### Get question by id +GET https://nisa-invest-tfb-be.vercel.app/quiz/questions/1 + +### Create question +POST https://nisa-invest-tfb-be.vercel.app/quiz/questions +Content-Type: application/json + +{ + "question": "Createtdhd fghfghby me", + "created_at": "2024-08-01T10:00:00+00" +} + +### Update question +PUT https://nisa-invest-tfb-be.vercel.app/quiz/questions/1 +Content-Type: application/json + +{ + "question": "Wfsafafdsfdsfdsafdsa?" +} + +### Delete question +DELETE https://nisa-invest-tfb-be.vercel.app/quiz/questions/1 + +### Answers Endpoints ### + +### Get all answers +GET https://nisa-invest-tfb-be.vercel.app/quiz/answers + +### Get answer by id +GET https://nisa-invest-tfb-be.vercel.app/quiz/answers/1 + +### Create answer +POST https://nisa-invest-tfb-be.vercel.app/quiz/answers +Content-Type: application/json + +{ + "answer_text": "Save more money", + "question_id": 1, + "goal_id": 2, + "created_at": "2024-08-01T10:00:00+00" +} + +### Update answer +PUT https://nisa-invest-tfb-be.vercel.app/quiz/answers/1 +Content-Type: application/json + +{ + "answer_text": "Invest in stocks", + "question_id": 1, + "goal_id": 16 +} + +### Delete answer +DELETE https://nisa-invest-tfb-be.vercel.app/quiz/answers/1 \ No newline at end of file