Add tenant services, change id by _id and include delete endpoint for all entities
This commit is contained in:
		| @@ -0,0 +1,15 @@ | ||||
| using Core.Thalos.Application.UseCases.Tenants.Input; | ||||
| using FluentValidation; | ||||
|  | ||||
| namespace Core.Thalos.Application.UseCases.Tenants.Validator | ||||
| { | ||||
|     public class ChangeTenantStatusValidator : AbstractValidator<ChangeTenantStatusRequest> | ||||
|     { | ||||
|         public ChangeTenantStatusValidator() | ||||
|         { | ||||
|             RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Tenant ID").WithMessage("Tenant ID is Obligatory."); | ||||
|             RuleFor(i => i.Status).NotNull().OverridePropertyName(x => x.Status).WithName("Status").WithMessage("Status is Obligatory."); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,74 @@ | ||||
| using Core.Thalos.Application.UseCases.Tenants.Input; | ||||
| using FluentValidation; | ||||
|  | ||||
| namespace Core.Thalos.Application.UseCases.Tenants.Validator | ||||
| { | ||||
|     public class CreateTenantValidator : AbstractValidator<CreateTenantRequest> | ||||
|     { | ||||
|         public CreateTenantValidator() | ||||
|         { | ||||
|             RuleFor(i => i.Name) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.Name) | ||||
|                 .WithName("Tenant Name") | ||||
|                 .WithMessage("Tenant Name is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.TaxIdentifier) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.TaxIdentifier) | ||||
|                 .WithName("Tax Identifier") | ||||
|                 .WithMessage("Tax Identifier is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.AddressLine1) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.AddressLine1) | ||||
|                 .WithName("Address Line 1") | ||||
|                 .WithMessage("Address Line 1 is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.City) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.City) | ||||
|                 .WithName("City") | ||||
|                 .WithMessage("City is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.State) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.State) | ||||
|                 .WithName("State") | ||||
|                 .WithMessage("State is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.Country) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.Country) | ||||
|                 .WithName("Country") | ||||
|                 .WithMessage("Country is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.PostalCode) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.PostalCode) | ||||
|                 .WithName("Postal Code") | ||||
|                 .WithMessage("Postal Code is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.ContactEmail) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.ContactEmail) | ||||
|                 .WithName("Contact Email") | ||||
|                 .WithMessage("Contact Email is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.ContactPhone) | ||||
|                 .NotEmpty() | ||||
|                 .NotNull() | ||||
|                 .OverridePropertyName(x => x.ContactPhone) | ||||
|                 .WithName("Contact Phone") | ||||
|                 .WithMessage("Contact Phone is obligatory."); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,66 @@ | ||||
| using Core.Thalos.Application.UseCases.Tenants.Input; | ||||
| using FluentValidation; | ||||
|  | ||||
| namespace Core.Thalos.Application.UseCases.Tenants.Validator | ||||
| { | ||||
|     public class UpdateTenantValidator : AbstractValidator<UpdateTenantRequest> | ||||
|     { | ||||
|         public UpdateTenantValidator() | ||||
|         { | ||||
|             RuleFor(i => i.Name) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Tenant Name") | ||||
|                 .WithMessage("Tenant Name is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.TaxIdentifier) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Tax Identifier") | ||||
|                 .WithMessage("Tax Identifier is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.AddressLine1) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Address Line 1") | ||||
|                 .WithMessage("Address Line 1 is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.City) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("City") | ||||
|                 .WithMessage("City is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.State) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("State") | ||||
|                 .WithMessage("State is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.Country) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Country") | ||||
|                 .WithMessage("Country is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.PostalCode) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Postal Code") | ||||
|                 .WithMessage("Postal Code is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.ContactEmail) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Contact Email") | ||||
|                 .WithMessage("Contact Email is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.ContactPhone) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Contact Phone") | ||||
|                 .WithMessage("Contact Phone is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i._Id) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Internal ID") | ||||
|                 .WithMessage("Internal ID is obligatory."); | ||||
|  | ||||
|             RuleFor(i => i.Id) | ||||
|                 .NotEmpty().NotNull() | ||||
|                 .WithName("Tenant ID") | ||||
|                 .WithMessage("Tenant ID is obligatory."); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin