Wave 2 — 3 parallel agents fixing P1 issues: Validators (57 new FluentValidation validators): - ads-manager: 10 validators for all commands - ads-billing: 3 validators for all commands - ads-tracking: 2 validators for missing commands - ads-analytics: 1 validator for CreateReport - social: 8 validators for all commands - mining: 16 validators for all commands - mission: 4 validators for all commands - promotion: 13 validators for all commands Missing handlers (10 implemented): - promotion: ExchangeVoucher, PurchaseVoucher, SearchVouchers, GetCampaignStatistics, GetCampaignVouchers - mission: GetUserMissionProgress - mkt-facebook: GetConversations, GetCustomers - ads-manager: ListAudiences, GetAudienceById All validators use bilingual messages (EN/VI) and are auto-registered via MediatR ValidatorBehavior pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using FluentValidation;
|
|
using AdsAnalyticsService.API.Application.Commands;
|
|
|
|
namespace AdsAnalyticsService.API.Application.Validations;
|
|
|
|
/// <summary>
|
|
/// EN: Validator for CreateReportCommand.
|
|
/// VI: Validator cho CreateReportCommand.
|
|
/// </summary>
|
|
public class CreateReportCommandValidator : AbstractValidator<CreateReportCommand>
|
|
{
|
|
public CreateReportCommandValidator()
|
|
{
|
|
RuleFor(x => x.AdvertiserId)
|
|
.NotEmpty()
|
|
.WithMessage("Advertiser ID is required / Advertiser ID là bắt buộc");
|
|
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty()
|
|
.WithMessage("Report name is required / Tên báo cáo là bắt buộc")
|
|
.MaximumLength(200)
|
|
.WithMessage("Report name max 200 characters / Tên báo cáo tối đa 200 ký tự");
|
|
|
|
RuleFor(x => x.ReportType)
|
|
.IsInEnum()
|
|
.WithMessage("Report type is invalid / Loại báo cáo không hợp lệ");
|
|
|
|
RuleFor(x => x.StartDate)
|
|
.NotEmpty()
|
|
.WithMessage("Start date is required / Ngày bắt đầu là bắt buộc");
|
|
|
|
RuleFor(x => x.EndDate)
|
|
.NotEmpty()
|
|
.WithMessage("End date is required / Ngày kết thúc là bắt buộc")
|
|
.GreaterThan(x => x.StartDate)
|
|
.WithMessage("End date must be after start date / Ngày kết thúc phải sau ngày bắt đầu");
|
|
}
|
|
}
|