This commit completes the migration of the backend service from a Node.js/Express application to an ASP.NET Core 8 Minimal API. - Re-implemented all API endpoints in C# for improved performance and type safety. - Updated the Gitea Actions workflow to use the `setup-dotnet` action, `dotnet publish` for building, and now caches NuGet packages. - Modified the deployment to create an `appsettings.Production.json` file from Gitea secrets instead of a `.env` file. - Updated the PM2 ecosystem configuration to run the application using the `dotnet` interpreter.
17 lines
599 B
C#
17 lines
599 B
C#
using FluentValidation;
|
|
using JoaoLoureiro.Portfolio.Api.Dtos;
|
|
|
|
namespace JoaoLoureiro.Portfolio.Api.Validators;
|
|
|
|
public class ContactMessageRequestValidator : AbstractValidator<ContactMessageRequest>
|
|
{
|
|
public ContactMessageRequestValidator()
|
|
{
|
|
RuleFor(x => x.Name).NotEmpty().WithErrorCode("status_error_all_fields");
|
|
RuleFor(x => x.Message).NotEmpty().WithErrorCode("status_error_all_fields");
|
|
RuleFor(x => x.Email)
|
|
.NotEmpty().WithErrorCode("status_error_all_fields")
|
|
.EmailAddress().WithErrorCode("status_error_invalid_email");
|
|
}
|
|
}
|