fix(ReviewEntity) , VER 1.4.14.19

subProduct
Amir Hossein Khademi 2024-09-21 20:51:01 +03:30
parent 56e8e3e1d9
commit 28ffed532d
13 changed files with 2119 additions and 12 deletions

View File

@ -1 +1 @@
1.4.12.17
1.4.14.19

View File

@ -5,7 +5,7 @@ public class ProductReviewController : ICarterModule
public void AddRoutes(IEndpointRouteBuilder app)
{
var group = app.NewVersionedApi("ProductReview")
.MapGroup("product/review");
.MapGroup("api/product/review");
group.MapGet("{id}", GetAsync)
.WithDisplayName("Get Product Review")

View File

@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>1.4.12.17</AssemblyVersion>
<FileVersion>1.4.12.17do</FileVersion>
<AssemblyVersion>1.4.14.19</AssemblyVersion>
<FileVersion>1.4.14.19</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,6 @@
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateReviewCommand(string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId) : IRequest<Guid>;
public sealed record UpdateReviewCommand(Guid Id,string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId): IRequest<Guid>;
public sealed record CreateReviewCommand(string Title, string Comment, float Rate, bool IsBuyer,bool IsAdmin, Guid ProductId, Guid UserId) : IRequest<Guid>;
public sealed record UpdateReviewCommand(Guid Id,string Title, string Comment, float Rate, bool IsBuyer, bool IsAdmin, Guid ProductId, Guid UserId): IRequest<Guid>;
public sealed record ConfirmReviewCommand(Guid Id) : IRequest<Guid>;
public sealed record DeleteReviewCommand(Guid Id) : IRequest<Guid>;

View File

@ -8,6 +8,7 @@ public class ReviewSDto : BaseDto<ReviewSDto, Review>
public string Comment { get; set; } = string.Empty;
public float Rate { get; set; }
public bool IsBuyer { get; set; }
public bool IsAdmin { get; set; }
public Guid ProductId { get; set; }
public Guid UserId { get; set; }
}

View File

@ -2,9 +2,9 @@
public partial class Review
{
public static Reviews.Review Create(string title, string comment, float rate, bool isBuyer, Guid productId, Guid userId)
public static Reviews.Review Create(string title, string comment, float rate, bool isBuyer,bool isAdmin, Guid productId, Guid userId)
{
return new Reviews.Review(title, comment, rate, isBuyer, productId, userId);
return new Reviews.Review(title, comment, rate, isBuyer,isAdmin, productId, userId);
}
public void ConfirmReview()

View File

@ -10,12 +10,13 @@ public partial class Review : ApiEntity
}
public Review(string title, string comment, float rate, bool isBuyer, Guid productId, Guid userId)
public Review(string title, string comment, float rate, bool isBuyer,bool isAdmin, Guid productId, Guid userId)
{
Title = title;
Comment = comment;
Rate = rate;
IsBuyer = isBuyer;
IsAdmin = isAdmin;
ProductId = productId;
UserId = userId;
}
@ -24,6 +25,7 @@ public partial class Review : ApiEntity
public float Rate { get; internal set; }
public bool IsBuyer { get; internal set; }
public bool IsConfirmed { get; internal set; }
public bool IsAdmin { get; internal set; }
public Guid ProductId { get; internal set; }
public Product? Product { get; internal set; }

View File

@ -127,6 +127,7 @@ namespace Netina.Domain.Mappers
Comment = p21.Comment,
Rate = p21.Rate,
IsBuyer = p21.IsBuyer,
IsAdmin = p21.IsAdmin,
ProductId = p21.ProductId,
UserId = p21.UserId,
Id = p21.Id,
@ -247,6 +248,7 @@ namespace Netina.Domain.Mappers
Comment = p37.Comment,
Rate = p37.Rate,
IsBuyer = p37.IsBuyer,
IsAdmin = p37.IsAdmin,
ProductId = p37.ProductId,
UserId = p37.UserId,
Id = p37.Id,
@ -494,6 +496,7 @@ namespace Netina.Domain.Mappers
Comment = item.Comment,
Rate = item.Rate,
IsBuyer = item.IsBuyer,
IsAdmin = item.IsAdmin,
ProductId = item.ProductId,
UserId = item.UserId,
Id = item.Id,
@ -615,6 +618,7 @@ namespace Netina.Domain.Mappers
Comment = item.Comment,
Rate = item.Rate,
IsBuyer = item.IsBuyer,
IsAdmin = item.IsAdmin,
ProductId = item.ProductId,
UserId = item.UserId,
Id = item.Id,
@ -708,6 +712,7 @@ namespace Netina.Domain.Mappers
Comment = item.Comment,
Rate = item.Rate,
IsBuyer = item.IsBuyer,
IsAdmin = item.IsAdmin,
ProductId = item.ProductId,
UserId = item.UserId,
Id = item.Id,
@ -800,6 +805,7 @@ namespace Netina.Domain.Mappers
Comment = item.Comment,
Rate = item.Rate,
IsBuyer = item.IsBuyer,
IsAdmin = item.IsAdmin,
ProductId = item.ProductId,
UserId = item.UserId,
Id = item.Id,

View File

@ -110,6 +110,7 @@ namespace Netina.Domain.Mappers
Comment = p9.Comment,
Rate = p9.Rate,
IsBuyer = p9.IsBuyer,
IsAdmin = p9.IsAdmin,
ProductId = p9.ProductId,
UserId = p9.UserId,
Id = p9.Id,
@ -128,6 +129,7 @@ namespace Netina.Domain.Mappers
result.Comment = p10.Comment;
result.Rate = p10.Rate;
result.IsBuyer = p10.IsBuyer;
result.IsAdmin = p10.IsAdmin;
result.ProductId = p10.ProductId;
result.UserId = p10.UserId;
result.Id = p10.Id;
@ -143,6 +145,7 @@ namespace Netina.Domain.Mappers
Comment = p12.Comment,
Rate = p12.Rate,
IsBuyer = p12.IsBuyer,
IsAdmin = p12.IsAdmin,
ProductId = p12.ProductId,
UserId = p12.UserId,
Id = p12.Id,
@ -161,6 +164,7 @@ namespace Netina.Domain.Mappers
result.Comment = p13.Comment;
result.Rate = p13.Rate;
result.IsBuyer = p13.IsBuyer;
result.IsAdmin = p13.IsAdmin;
result.ProductId = p13.ProductId;
result.UserId = p13.UserId;
result.Id = p13.Id;
@ -174,6 +178,7 @@ namespace Netina.Domain.Mappers
Comment = p15.Comment,
Rate = p15.Rate,
IsBuyer = p15.IsBuyer,
IsAdmin = p15.IsAdmin,
ProductId = p15.ProductId,
UserId = p15.UserId,
Id = p15.Id,

View File

@ -13,7 +13,7 @@ public class CreateReviewCommandHandler(IRepositoryWrapper repositoryWrapper,ICu
if (!Guid.TryParse(currentUserService.UserId, out userId))
throw new AppException("User id is wrong", ApiResultStatusCode.BadRequest);
}
var review = Review.Create(request.Title, request.Comment, request.Rate, request.IsBuyer, request.ProductId,
var review = Review.Create(request.Title, request.Comment, request.Rate, request.IsBuyer, request.IsAdmin, request.ProductId,
userId);
var product = await repositoryWrapper.SetRepository<Product>()
.TableNoTracking

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class AddIsAdminReview : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsAdmin",
schema: "public",
table: "Reviews",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsAdmin",
schema: "public",
table: "Reviews");
}
}
}

View File

@ -975,6 +975,9 @@ namespace NetinaShop.Repository.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAdmin")
.HasColumnType("boolean");
b.Property<bool>("IsBuyer")
.HasColumnType("boolean");