Generator Changes at 9/27/2025 10:36:00 AM

This commit is contained in:
generator
2025-09-27 10:36:00 +03:30
parent 15a7933a7a
commit 0e32dc9359
220 changed files with 7313 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
public record CreateNewPackageCommand : IRequest<CreateNewPackageResponseDto>
{
//عنوان
public string Title { get; init; }
//توضیحات
public string Description { get; init; }
//آدرس تصویر
public string ImagePath { get; init; }
//قیمت
public long Price { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
public class CreateNewPackageCommandHandler : IRequestHandler<CreateNewPackageCommand, CreateNewPackageResponseDto>
{
private readonly IApplicationContractContext _context;
public CreateNewPackageCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<CreateNewPackageResponseDto> Handle(CreateNewPackageCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new CreateNewPackageResponseDto();
}
}

View File

@@ -0,0 +1,22 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
public class CreateNewPackageCommandValidator : AbstractValidator<CreateNewPackageCommand>
{
public CreateNewPackageCommandValidator()
{
RuleFor(model => model.Title)
.NotEmpty();
RuleFor(model => model.Description)
.NotEmpty();
RuleFor(model => model.ImagePath)
.NotEmpty();
RuleFor(model => model.Price)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewPackageCommand>.CreateWithOptions((CreateNewPackageCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -0,0 +1,7 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
public class CreateNewPackageResponseDto
{
//شناسه
public long Id { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.DeletePackage;
public record DeletePackageCommand : IRequest<Unit>
{
//شناسه
public long Id { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.DeletePackage;
public class DeletePackageCommandHandler : IRequestHandler<DeletePackageCommand, Unit>
{
private readonly IApplicationContractContext _context;
public DeletePackageCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<Unit> Handle(DeletePackageCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
}
}

View File

@@ -0,0 +1,16 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.DeletePackage;
public class DeletePackageCommandValidator : AbstractValidator<DeletePackageCommand>
{
public DeletePackageCommandValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<DeletePackageCommand>.CreateWithOptions((DeletePackageCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -0,0 +1,15 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.UpdatePackage;
public record UpdatePackageCommand : IRequest<Unit>
{
//شناسه
public long Id { get; init; }
//عنوان
public string Title { get; init; }
//توضیحات
public string Description { get; init; }
//آدرس تصویر
public string ImagePath { get; init; }
//قیمت
public long Price { get; init; }
}

View File

@@ -0,0 +1,16 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.UpdatePackage;
public class UpdatePackageCommandHandler : IRequestHandler<UpdatePackageCommand, Unit>
{
private readonly IApplicationContractContext _context;
public UpdatePackageCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<Unit> Handle(UpdatePackageCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
}
}

View File

@@ -0,0 +1,24 @@
namespace FrontOffice.BFF.Application.PackageCQ.Commands.UpdatePackage;
public class UpdatePackageCommandValidator : AbstractValidator<UpdatePackageCommand>
{
public UpdatePackageCommandValidator()
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Title)
.NotEmpty();
RuleFor(model => model.Description)
.NotEmpty();
RuleFor(model => model.ImagePath)
.NotEmpty();
RuleFor(model => model.Price)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<UpdatePackageCommand>.CreateWithOptions((UpdatePackageCommand)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}