diff --git a/app/main.py b/app/main.py index 6d3a66f..d2cb59b 100644 --- a/app/main.py +++ b/app/main.py @@ -8,7 +8,7 @@ from typing import List from fastapi import FastAPI, Request, Form from fastapi.responses import HTMLResponse, RedirectResponse, StreamingResponse from fastapi.templating import Jinja2Templates -from pydantic import BaseModel +from pydantic import BaseModel, Field from fpdf import FPDF import logging @@ -68,13 +68,13 @@ class MathExercisesPDF(FPDF): class ExerciseRequest(BaseModel): min_table: int max_table: int - num_exercises: int = 15 + num_exercises: int = Field(15, ge=1, le=100) multiplication_only: bool = False - max_first_operand: int = 12 # New parameter for the maximum value of the first operand + max_first_operand: int = Field(12, ge=1, le=12) # New parameter for the maximum value of the first operand class OperationExerciseRequest(BaseModel): - num_exercises: int = 20 + num_exercises: int = Field(20, ge=1, le=100) def generate_exercises(