18 lines
633 B
C#
18 lines
633 B
C#
using FluentValidation;
|
|
|
|
namespace Application.Endpoints.Chats;
|
|
|
|
public class SendMessageValidator : AbstractValidator<SendMessageDto>
|
|
{
|
|
public SendMessageValidator()
|
|
{
|
|
RuleFor(x => x.Sender)
|
|
.NotEmpty().WithMessage("Sender Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
|
|
|
RuleFor(x => x.Receiver)
|
|
.NotEmpty().WithMessage("Receiver Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
|
|
|
RuleFor(x => x.Message)
|
|
.NotEmpty().WithMessage("Message is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
|
|
}
|
|
} |