[Added] Most of the frontend, split up backend services

This commit is contained in:
Ninjaws
2024-10-31 23:05:22 +01:00
parent 2505fce920
commit 3188f6ce20
48 changed files with 1391 additions and 398 deletions
@@ -1,5 +1,6 @@
package com.ninjaws.quiz.models;
import com.ninjaws.quiz.models.QuizSettings.Category;
import com.ninjaws.quiz.models.QuizSettings.Difficulty;
import jakarta.validation.Valid;
@@ -54,6 +55,21 @@ public class QuizSettings {
private Category category = Category.ANY;
public QuizSettings(){}
/** Inverse of toApiQuery */
public QuizSettings(int amount, Integer category, String difficulty, String type) {
System.out.println(amount);
System.out.print(category);
System.out.print(difficulty);
System.out.print(type);
this.amount = amount;
this.category = category == null ? Category.ANY : Category.values()[category];
this.difficulty = difficulty == null ? Difficulty.ANY : Difficulty.valueOf(difficulty.toUpperCase());
this.type = type == null ? Type.ANY : type.equals("boolean") ? Type.BOOLEAN : Type.MULTIPLE;
}
/**
* Ensures the value is between 1 and 50
* @Valid doesn't seem to be enforcing it, so this ensures the value is legal