academia/src/backend/Application/Students/Queries/GetStudentByIdValidator.cs

18 lines
463 B
C#

namespace Application.Students.Queries;
using Application.Common;
using FluentValidation;
/// <summary>
/// Validator for <see cref="GetStudentByIdQuery"/>.
/// Ensures the student ID is valid before querying.
/// </summary>
public class GetStudentByIdValidator : AbstractValidator<GetStudentByIdQuery>
{
public GetStudentByIdValidator()
{
RuleFor(x => x.Id)
.GreaterThan(0).WithMessage(ValidationPatterns.InvalidIdMessage);
}
}