-
+
=10'}
@@ -1835,6 +1832,9 @@ packages:
csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
+ daisyui@5.0.0:
+ resolution: {integrity: sha512-U0K9Bac3Bi3zZGm6ojrw12F0vBHTpEgf46zv/BYxLe07hF0Xnx7emIQliwaRBgJuYhY0BhwQ6wSnq5cJXHA2yA==}
+
date-fns@4.1.0:
resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
@@ -4190,8 +4190,6 @@ packages:
snapshots:
- 7.css@0.17.0: {}
-
'@alloc/quick-lru@5.2.0': {}
'@ampproject/remapping@2.3.0':
@@ -5984,6 +5982,8 @@ snapshots:
csstype@3.1.3: {}
+ daisyui@5.0.0: {}
+
date-fns@4.1.0: {}
db0@0.2.4(drizzle-orm@0.40.0(@types/pg@8.11.11)(gel@2.0.0)(pg@8.13.3)):
diff --git a/server/api/advanced.get.ts b/server/api/advanced.get.ts
index f5b4bba..d241751 100644
--- a/server/api/advanced.get.ts
+++ b/server/api/advanced.get.ts
@@ -56,11 +56,28 @@ export default defineEventHandler(async (event) => {
}
const query = getQuery(event);
const category = query.category;
- if (typeof category != "undefined" && typeof category != "string") {
+ const categories = [
+ "A",
+ "B",
+ "C",
+ "D",
+ "T",
+ "AM",
+ "A1",
+ "A2",
+ "B1",
+ "C1",
+ "D1",
+ "PT",
+ ];
+ if (category == null || category == "") {
throw new Error(
"category argument has to be string (or not to be defined at all)"
);
}
+ if (!categories.includes(`${category}`)) {
+ throw new Error(`category argument has to be equal to: ${categories}`);
+ }
const db = drizzle(process.env.DATABASE_URL!);
const randomizedQuestions: AdvancedQuestion[] = [];
@@ -81,7 +98,7 @@ export default defineEventHandler(async (event) => {
if (
questionsKeyPoints[randomized].kategorie
.split(",")
- .includes(category ?? "B")
+ .includes(`${category}`)
) {
chosenRandomQuestions.push(questionsKeyPoints[randomized]);
} else {
diff --git a/server/api/basic.get.ts b/server/api/basic.get.ts
index f84bc37..1c1d95c 100644
--- a/server/api/basic.get.ts
+++ b/server/api/basic.get.ts
@@ -35,11 +35,28 @@ export default defineEventHandler(async (event) => {
}
const query = getQuery(event);
const category = query.category;
- if (typeof category != "undefined" && typeof category != "string") {
+ const categories = [
+ "A",
+ "B",
+ "C",
+ "D",
+ "T",
+ "AM",
+ "A1",
+ "A2",
+ "B1",
+ "C1",
+ "D1",
+ "PT",
+ ];
+ if (category == null || category == "") {
throw new Error(
"category argument has to be string (or not to be defined at all)"
);
}
+ if (!categories.includes(`${category}`)) {
+ throw new Error(`category argument has to be equal to: ${categories}`);
+ }
const db = drizzle(process.env.DATABASE_URL!);
const randomizedQuestions: BasicQuestion[] = [];
@@ -60,7 +77,7 @@ export default defineEventHandler(async (event) => {
if (
questionsKeyPoints[randomized].kategorie
.split(",")
- .includes(category ?? "B")
+ .includes(`${category}`)
) {
chosenRandomQuestions.push(questionsKeyPoints[randomized]);
} else {
diff --git a/store/examResults.ts b/store/examStore.ts
similarity index 62%
rename from store/examResults.ts
rename to store/examStore.ts
index e9ae1ca..176ba62 100644
--- a/store/examResults.ts
+++ b/store/examStore.ts
@@ -1,12 +1,17 @@
import { defineStore } from "pinia";
-export const useExamStore = defineStore("exam-results", () => {
+export const useExamStore = defineStore("exam-store", () => {
+ const category = ref("");
const end = ref(false);
const result: Ref = ref({
basic: [],
advanced: [],
});
function resetExam() {
+ category.value = "";
+ mildReset();
+ }
+ function mildReset() {
end.value = false;
result.value = {
basic: [],
@@ -15,8 +20,10 @@ export const useExamStore = defineStore("exam-results", () => {
}
return {
+ category,
end,
result,
resetExam,
+ mildReset,
};
});
diff --git a/tailwind.config.ts b/tailwind.config.ts
new file mode 100644
index 0000000..5275c3d
--- /dev/null
+++ b/tailwind.config.ts
@@ -0,0 +1,7 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ plugins: [require("daisyui")],
+ daisyui: {
+ themes: ["light", "dark"],
+ },
+};