diff --git a/Endpoint/Controllers/V1/DisciplineController.cs b/Endpoint/Controllers/V1/DisciplineController.cs
index e02b94d..cde5ebc 100644
--- a/Endpoint/Controllers/V1/DisciplineController.cs
+++ b/Endpoint/Controllers/V1/DisciplineController.cs
@@ -6,6 +6,7 @@ using Mirea.Api.DataAccess.Application.Cqrs.Discipline.Queries.GetDisciplineList
using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
@@ -23,7 +24,7 @@ public class DisciplineController(IMediator mediator) : BaseController
/// Paginated list of disciplines.
[HttpGet]
[BadRequestResponse]
- public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize)
+ public async Task>> Get([FromQuery][Range(0, int.MaxValue)] int? page, [FromQuery][Range(1, int.MaxValue)] int? pageSize)
{
var result = await mediator.Send(new GetDisciplineListQuery()
{
diff --git a/Endpoint/Controllers/V1/FacultyController.cs b/Endpoint/Controllers/V1/FacultyController.cs
index 3b5af11..f21352e 100644
--- a/Endpoint/Controllers/V1/FacultyController.cs
+++ b/Endpoint/Controllers/V1/FacultyController.cs
@@ -5,6 +5,7 @@ using Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyList;
using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
@@ -22,7 +23,7 @@ public class FacultyController(IMediator mediator) : BaseController
/// Paginated list of faculties.
[HttpGet]
[BadRequestResponse]
- public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize)
+ public async Task>> Get([FromQuery][Range(0, int.MaxValue)] int? page, [FromQuery][Range(1, int.MaxValue)] int? pageSize)
{
var result = await mediator.Send(new GetFacultyListQuery()
{
diff --git a/Endpoint/Controllers/V1/GroupController.cs b/Endpoint/Controllers/V1/GroupController.cs
index ebac4cb..4041b84 100644
--- a/Endpoint/Controllers/V1/GroupController.cs
+++ b/Endpoint/Controllers/V1/GroupController.cs
@@ -7,6 +7,7 @@ using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
@@ -37,7 +38,7 @@ public class GroupController(IMediator mediator) : BaseController
/// A list of groups.
[HttpGet]
[BadRequestResponse]
- public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize)
+ public async Task>> Get([FromQuery][Range(0, int.MaxValue)] int? page, [FromQuery][Range(1, int.MaxValue)] int? pageSize)
{
var result = await mediator.Send(new GetGroupListQuery()
{
diff --git a/Endpoint/Controllers/V1/ProfessorController.cs b/Endpoint/Controllers/V1/ProfessorController.cs
index 989105a..0c1a171 100644
--- a/Endpoint/Controllers/V1/ProfessorController.cs
+++ b/Endpoint/Controllers/V1/ProfessorController.cs
@@ -6,7 +6,9 @@ using Mirea.Api.DataAccess.Application.Cqrs.Professor.Queries.GetProfessorDetail
using Mirea.Api.DataAccess.Application.Cqrs.Professor.Queries.GetProfessorList;
using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
+using Mirea.Api.Endpoint.Common.Exceptions;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
@@ -24,7 +26,7 @@ public class ProfessorController(IMediator mediator) : BaseController
/// A list of professors.
[HttpGet]
[BadRequestResponse]
- public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize)
+ public async Task>> Get([FromQuery][Range(0, int.MaxValue)] int? page, [FromQuery][Range(1, int.MaxValue)] int? pageSize)
{
var result = await mediator.Send(new GetProfessorListQuery()
{
@@ -78,7 +80,7 @@ public class ProfessorController(IMediator mediator) : BaseController
[HttpGet("{name:required}")]
[BadRequestResponse]
[NotFoundResponse]
- public async Task>> GetDetails(string name)
+ public async Task>> GetDetails([MinLength(4)] string name)
{
if (string.IsNullOrEmpty(name) || name.Length < 4)
throw new ControllerArgumentException($"The minimum number of characters is 4 (current: {name.Length}).");