[Added] Most of the frontend, split up backend services
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user