Finish code base

This commit is contained in:
AndrewTrieu
2023-03-12 17:29:07 +02:00
parent b3065cfce1
commit 7089f460a4
8 changed files with 22 additions and 14 deletions

View File

@@ -26,6 +26,9 @@ const getTopicByTopicId = async (topicId) => {
};
const deleteTopic = async (topicId) => {
await sql`DELETE FROM question_answers WHERE question_id IN (SELECT id FROM questions WHERE topic_id = ${topicId})`;
await sql`DELETE FROM question_answer_options WHERE question_id IN (SELECT id FROM questions WHERE topic_id = ${topicId})`;
await sql`DELETE FROM questions WHERE topic_id = ${topicId}`;
await sql`DELETE FROM topics WHERE id = ${topicId}`;
};