add auuthor
parent
fda7088abb
commit
8e5003028d
|
@ -1,6 +1,8 @@
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Netina.Api.Services;
|
||||||
using Netina.Domain.Entities.Blogs;
|
using Netina.Domain.Entities.Blogs;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using Netina.Repository.Abstracts;
|
||||||
|
|
||||||
namespace Netina.Api.Controllers;
|
namespace Netina.Api.Controllers;
|
||||||
|
|
||||||
|
@ -77,9 +79,13 @@ public class BlogController : ICarterModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST:Create Entity
|
// POST:Create Entity
|
||||||
public async Task<IResult> Post([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
public async Task<IResult> Post([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var ent = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested,dto.CategoryId);
|
if (currentUserService.UserId == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
var ent = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested,dto.CategoryId, userId);
|
||||||
foreach (var file in dto.Files)
|
foreach (var file in dto.Files)
|
||||||
{
|
{
|
||||||
ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||||
|
@ -91,13 +97,17 @@ public class BlogController : ICarterModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT:Update Entity
|
// PUT:Update Entity
|
||||||
public async Task<IResult> Put([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
public async Task<IResult> Put([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var ent = await repositoryWrapper.SetRepository<Blog>().TableNoTracking
|
var ent = await repositoryWrapper.SetRepository<Blog>().TableNoTracking
|
||||||
.FirstOrDefaultAsync(b => b.Id == dto.Id, cancellationToken);
|
.FirstOrDefaultAsync(b => b.Id == dto.Id, cancellationToken);
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
throw new AppException("Blog not found");
|
throw new AppException("Blog not found");
|
||||||
var newEnt = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested, dto.CategoryId);
|
if (currentUserService.UserId == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
var newEnt = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested, dto.CategoryId, userId);
|
||||||
newEnt.Id = ent.Id;
|
newEnt.Id = ent.Id;
|
||||||
newEnt.CreatedAt = ent.CreatedAt;
|
newEnt.CreatedAt = ent.CreatedAt;
|
||||||
newEnt.CreatedBy = ent.CreatedBy;
|
newEnt.CreatedBy = ent.CreatedBy;
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class SeedController(IWebHostEnvironment environment) : ICarterModule
|
||||||
seedBlogRequestDto.CategoryId = noCategory.Id;
|
seedBlogRequestDto.CategoryId = noCategory.Id;
|
||||||
}
|
}
|
||||||
var ent = Blog.Create(seedBlogRequestDto.Title, seedBlogRequestDto.Slug, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime,
|
var ent = Blog.Create(seedBlogRequestDto.Title, seedBlogRequestDto.Slug, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime,
|
||||||
seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId);
|
seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId,default);
|
||||||
|
|
||||||
foreach (var storageFileSDto in seedBlogRequestDto.Files)
|
foreach (var storageFileSDto in seedBlogRequestDto.Files)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<AssemblyVersion>1.3.12.16</AssemblyVersion>
|
<AssemblyVersion>1.4.12.17</AssemblyVersion>
|
||||||
<FileVersion>1.3.12.16</FileVersion>
|
<FileVersion>1.4.12.17do</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
namespace Netina.Common.Models.Entity
|
namespace Netina.Common.Models.Entity
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class PageClassDisplay(string name, string description) : Attribute
|
public class PageClassDisplay : Attribute
|
||||||
{
|
{
|
||||||
|
private readonly string _name;
|
||||||
|
private readonly string _description;
|
||||||
|
|
||||||
|
public PageClassDisplay(string name, string description)
|
||||||
|
{
|
||||||
|
_name = name;
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
public string GetName()
|
public string GetName()
|
||||||
{
|
{
|
||||||
return name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetDescription()
|
public string GetDescription()
|
||||||
{
|
{
|
||||||
return description;
|
return _description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,5 +12,7 @@ public class BlogLDto : BaseDto<BlogLDto , Blog>
|
||||||
public bool IsSuggested { get; set; }
|
public bool IsSuggested { get; set; }
|
||||||
public Guid CategoryId { get; set; }
|
public Guid CategoryId { get; set; }
|
||||||
public string CategoryName { get; set; } = string.Empty;
|
public string CategoryName { get; set; } = string.Empty;
|
||||||
|
public Guid AuthorId { get; set; }
|
||||||
|
public string AuthorFullName { get; set; } = string.Empty;
|
||||||
public List<StorageFileSDto> Files { get; set; } = new();
|
public List<StorageFileSDto> Files { get; set; } = new();
|
||||||
}
|
}
|
|
@ -31,4 +31,6 @@ public class ProductLDto : BaseDto<ProductLDto,Product>
|
||||||
public List<StorageFileSDto> Files { get; set; } = new();
|
public List<StorageFileSDto> Files { get; set; } = new();
|
||||||
|
|
||||||
public DiscountSDto? SpecialOffer { get; set; }
|
public DiscountSDto? SpecialOffer { get; set; }
|
||||||
|
public Guid AuthorId { get; set; }
|
||||||
|
public string AuthorFullName { get; set; } = string.Empty;
|
||||||
}
|
}
|
|
@ -12,4 +12,6 @@ public class BlogSDto : BaseDto<BlogSDto , Blog>
|
||||||
public string CategoryName { get; set; } = string.Empty;
|
public string CategoryName { get; set; } = string.Empty;
|
||||||
public string MainImage { get; set; } = string.Empty;
|
public string MainImage { get; set; } = string.Empty;
|
||||||
public DateTime ModifiedAt { get; set; }
|
public DateTime ModifiedAt { get; set; }
|
||||||
|
public Guid AuthorId { get; set; }
|
||||||
|
public string AuthorFullName { get; set; } = string.Empty;
|
||||||
}
|
}
|
|
@ -30,4 +30,6 @@ public class ProductSDto : BaseDto<ProductSDto, Product>
|
||||||
public string BrandName { get; set; } = string.Empty;
|
public string BrandName { get; set; } = string.Empty;
|
||||||
public string CategoryName { get; set; } = string.Empty;
|
public string CategoryName { get; set; } = string.Empty;
|
||||||
public DateTime ModifiedAt { get; set; }
|
public DateTime ModifiedAt { get; set; }
|
||||||
|
public Guid AuthorId { get; set; }
|
||||||
|
public string AuthorFullName { get; set; } = string.Empty;
|
||||||
}
|
}
|
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
public partial class Blog
|
public partial class Blog
|
||||||
{
|
{
|
||||||
public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
|
public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId, Guid authorId)
|
||||||
{
|
{
|
||||||
var slug = StringExtensions.GetSlug(title);
|
var slug = StringExtensions.GetSlug(title);
|
||||||
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId);
|
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId,authorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
|
public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId, Guid authorId)
|
||||||
{
|
{
|
||||||
if (slug.IsNullOrEmpty())
|
if (slug.IsNullOrEmpty())
|
||||||
slug = StringExtensions.GetSlug(title);
|
slug = StringExtensions.GetSlug(title);
|
||||||
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId);
|
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId, authorId);
|
||||||
}
|
}
|
||||||
public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)
|
public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ public partial class Blog : ApiEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public Blog(string title,string slug,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId)
|
public Blog(string title,string slug,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId,Guid authorId)
|
||||||
{
|
{
|
||||||
Title = title;
|
Title = title;
|
||||||
Content = content;
|
Content = content;
|
||||||
|
@ -20,6 +20,7 @@ public partial class Blog : ApiEntity
|
||||||
Summery = summery;
|
Summery = summery;
|
||||||
IsSuggested = isSuggested;
|
IsSuggested = isSuggested;
|
||||||
CategoryId = categoryId;
|
CategoryId = categoryId;
|
||||||
|
AuthorId = authorId;
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
}
|
}
|
||||||
public string Title { get; internal set; } = string.Empty;
|
public string Title { get; internal set; } = string.Empty;
|
||||||
|
@ -32,5 +33,7 @@ public partial class Blog : ApiEntity
|
||||||
public Guid CategoryId { get; internal set; }
|
public Guid CategoryId { get; internal set; }
|
||||||
public BlogCategory? Category { get; internal set; }
|
public BlogCategory? Category { get; internal set; }
|
||||||
public List<BlogStorageFile> Files { get; internal set; } = new();
|
public List<BlogStorageFile> Files { get; internal set; } = new();
|
||||||
|
public Guid AuthorId { get; internal set; }
|
||||||
|
public ApplicationUser? Author { get; internal set; }
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||||
[GenerateMapper]
|
[GenerateMapper]
|
||||||
|
|
||||||
[Index(nameof(Slug), IsUnique = true)]
|
//[Index(nameof(Slug), IsUnique = true)]
|
||||||
public partial class Brand : ApiEntity
|
public partial class Brand : ApiEntity
|
||||||
{
|
{
|
||||||
public Brand()
|
public Brand()
|
||||||
|
|
|
@ -10,7 +10,7 @@ public partial class Product
|
||||||
int stock,
|
int stock,
|
||||||
int maxOrderCount,
|
int maxOrderCount,
|
||||||
Guid brandId,
|
Guid brandId,
|
||||||
Guid categoryId)
|
Guid categoryId, Guid authorId)
|
||||||
{
|
{
|
||||||
var slug = StringExtensions.GetSlug(persianName);
|
var slug = StringExtensions.GetSlug(persianName);
|
||||||
return new Product(
|
return new Product(
|
||||||
|
@ -29,7 +29,7 @@ public partial class Product
|
||||||
maxOrderCount,
|
maxOrderCount,
|
||||||
stock > 0,
|
stock > 0,
|
||||||
brandId,
|
brandId,
|
||||||
categoryId);
|
categoryId,authorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRate(float rate)
|
public void AddRate(float rate)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[GenerateMapper]
|
[GenerateMapper]
|
||||||
|
|
||||||
|
|
||||||
[Index(nameof(Slug), IsUnique = true)]
|
//[Index(nameof(Slug), IsUnique = true)]
|
||||||
public partial class Product : ApiEntity
|
public partial class Product : ApiEntity
|
||||||
{
|
{
|
||||||
public Product()
|
public Product()
|
||||||
|
@ -32,7 +32,8 @@ public partial class Product : ApiEntity
|
||||||
int maxOrderCount,
|
int maxOrderCount,
|
||||||
bool isEnable,
|
bool isEnable,
|
||||||
Guid brandId,
|
Guid brandId,
|
||||||
Guid categoryId)
|
Guid categoryId,
|
||||||
|
Guid authorId)
|
||||||
{
|
{
|
||||||
PersianName = persianName;
|
PersianName = persianName;
|
||||||
EnglishName = englishName;
|
EnglishName = englishName;
|
||||||
|
@ -50,6 +51,7 @@ public partial class Product : ApiEntity
|
||||||
IsEnable = isEnable;
|
IsEnable = isEnable;
|
||||||
BrandId = brandId;
|
BrandId = brandId;
|
||||||
CategoryId = categoryId;
|
CategoryId = categoryId;
|
||||||
|
AuthorId = authorId;
|
||||||
}
|
}
|
||||||
public string PersianName { get; internal set; } = string.Empty;
|
public string PersianName { get; internal set; } = string.Empty;
|
||||||
public string EnglishName { get; internal set; } = string.Empty;
|
public string EnglishName { get; internal set; } = string.Empty;
|
||||||
|
@ -73,6 +75,8 @@ public partial class Product : ApiEntity
|
||||||
public Brand? Brand { get; internal set; }
|
public Brand? Brand { get; internal set; }
|
||||||
|
|
||||||
public Guid CategoryId { get; internal set; }
|
public Guid CategoryId { get; internal set; }
|
||||||
|
public Guid AuthorId { get; internal set; }
|
||||||
|
public ApplicationUser? Author { get; internal set; }
|
||||||
public ProductCategory? Category { get; internal set; }
|
public ProductCategory? Category { get; internal set; }
|
||||||
|
|
||||||
public List<Specification> Specifications { get; internal set; } = new();
|
public List<Specification> Specifications { get; internal set; } = new();
|
||||||
|
|
|
@ -2,9 +2,11 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
using Mapster.Models;
|
||||||
using Netina.Domain.Dtos.LargDtos;
|
using Netina.Domain.Dtos.LargDtos;
|
||||||
using Netina.Domain.Dtos.SmallDtos;
|
using Netina.Domain.Dtos.SmallDtos;
|
||||||
using Netina.Domain.Entities.Blogs;
|
using Netina.Domain.Entities.Blogs;
|
||||||
|
using Netina.Domain.Entities.Users;
|
||||||
|
|
||||||
namespace Netina.Domain.Mappers
|
namespace Netina.Domain.Mappers
|
||||||
{
|
{
|
||||||
|
@ -55,6 +57,8 @@ namespace Netina.Domain.Mappers
|
||||||
Name = p8.CategoryName,
|
Name = p8.CategoryName,
|
||||||
Id = p8.CategoryId
|
Id = p8.CategoryId
|
||||||
},
|
},
|
||||||
|
AuthorId = p8.AuthorId,
|
||||||
|
Author = new ApplicationUser() {Id = p8.AuthorId},
|
||||||
Id = p8.Id,
|
Id = p8.Id,
|
||||||
CreatedAt = p8.CreatedAt,
|
CreatedAt = p8.CreatedAt,
|
||||||
ModifiedAt = p8.ModifiedAt
|
ModifiedAt = p8.ModifiedAt
|
||||||
|
@ -105,6 +109,7 @@ namespace Netina.Domain.Mappers
|
||||||
CategoryName = p16.Category.Name,
|
CategoryName = p16.Category.Name,
|
||||||
MainImage = p16.Files.Count > 0 && p16.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p16.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
MainImage = p16.Files.Count > 0 && p16.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p16.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||||
ModifiedAt = p16.ModifiedAt,
|
ModifiedAt = p16.ModifiedAt,
|
||||||
|
AuthorId = p16.AuthorId,
|
||||||
Id = p16.Id,
|
Id = p16.Id,
|
||||||
CreatedAt = p16.CreatedAt
|
CreatedAt = p16.CreatedAt
|
||||||
}).ToList<BlogSDto>(),
|
}).ToList<BlogSDto>(),
|
||||||
|
@ -118,6 +123,9 @@ namespace Netina.Domain.Mappers
|
||||||
Name = p17.Name,
|
Name = p17.Name,
|
||||||
Slug = p17.Slug,
|
Slug = p17.Slug,
|
||||||
Description = p17.Description,
|
Description = p17.Description,
|
||||||
|
IsMain = p17.IsMain,
|
||||||
|
ParentId = (Guid?)p17.ParentId,
|
||||||
|
Parent = new BlogCategory() {Id = p17.ParentId},
|
||||||
Id = p17.Id,
|
Id = p17.Id,
|
||||||
CreatedAt = p17.CreatedAt
|
CreatedAt = p17.CreatedAt
|
||||||
};
|
};
|
||||||
|
@ -133,48 +141,57 @@ namespace Netina.Domain.Mappers
|
||||||
result.Name = p18.Name;
|
result.Name = p18.Name;
|
||||||
result.Slug = p18.Slug;
|
result.Slug = p18.Slug;
|
||||||
result.Description = p18.Description;
|
result.Description = p18.Description;
|
||||||
|
result.IsMain = p18.IsMain;
|
||||||
|
result.ParentId = (Guid?)p18.ParentId;
|
||||||
|
result.Parent = funcMain7(new Never(), result.Parent, p18);
|
||||||
result.Id = p18.Id;
|
result.Id = p18.Id;
|
||||||
result.CreatedAt = p18.CreatedAt;
|
result.CreatedAt = p18.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static BlogCategorySDto AdaptToSDto(this BlogCategory p20)
|
public static BlogCategorySDto AdaptToSDto(this BlogCategory p22)
|
||||||
{
|
{
|
||||||
return p20 == null ? null : new BlogCategorySDto()
|
return p22 == null ? null : new BlogCategorySDto()
|
||||||
{
|
{
|
||||||
Name = p20.Name,
|
Name = p22.Name,
|
||||||
BlogCount = funcMain7(p20.Blogs == null ? null : (int?)p20.Blogs.Count),
|
BlogCount = funcMain8(p22.Blogs == null ? null : (int?)p22.Blogs.Count),
|
||||||
Description = p20.Description,
|
Description = p22.Description,
|
||||||
Slug = p20.Slug,
|
Slug = p22.Slug,
|
||||||
Id = p20.Id,
|
IsMain = p22.IsMain,
|
||||||
CreatedAt = p20.CreatedAt
|
ParentId = p22.ParentId == null ? default(Guid) : (Guid)p22.ParentId,
|
||||||
|
Id = p22.Id,
|
||||||
|
CreatedAt = p22.CreatedAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static BlogCategorySDto AdaptTo(this BlogCategory p22, BlogCategorySDto p23)
|
public static BlogCategorySDto AdaptTo(this BlogCategory p24, BlogCategorySDto p25)
|
||||||
{
|
{
|
||||||
if (p22 == null)
|
if (p24 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlogCategorySDto result = p23 ?? new BlogCategorySDto();
|
BlogCategorySDto result = p25 ?? new BlogCategorySDto();
|
||||||
|
|
||||||
result.Name = p22.Name;
|
result.Name = p24.Name;
|
||||||
result.BlogCount = funcMain8(p22.Blogs == null ? null : (int?)p22.Blogs.Count, result.BlogCount);
|
result.BlogCount = funcMain9(p24.Blogs == null ? null : (int?)p24.Blogs.Count, result.BlogCount);
|
||||||
result.Description = p22.Description;
|
result.Description = p24.Description;
|
||||||
result.Slug = p22.Slug;
|
result.Slug = p24.Slug;
|
||||||
result.Id = p22.Id;
|
result.IsMain = p24.IsMain;
|
||||||
result.CreatedAt = p22.CreatedAt;
|
result.ParentId = p24.ParentId == null ? default(Guid) : (Guid)p24.ParentId;
|
||||||
|
result.Id = p24.Id;
|
||||||
|
result.CreatedAt = p24.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Expression<Func<BlogCategory, BlogCategorySDto>> ProjectToSDto => p26 => new BlogCategorySDto()
|
public static Expression<Func<BlogCategory, BlogCategorySDto>> ProjectToSDto => p28 => new BlogCategorySDto()
|
||||||
{
|
{
|
||||||
Name = p26.Name,
|
Name = p28.Name,
|
||||||
BlogCount = p26.Blogs.Count,
|
BlogCount = p28.Blogs.Count,
|
||||||
Description = p26.Description,
|
Description = p28.Description,
|
||||||
Slug = p26.Slug,
|
Slug = p28.Slug,
|
||||||
Id = p26.Id,
|
IsMain = p28.IsMain,
|
||||||
CreatedAt = p26.CreatedAt
|
ParentId = p28.ParentId == null ? default(Guid) : (Guid)p28.ParentId,
|
||||||
|
Id = p28.Id,
|
||||||
|
CreatedAt = p28.CreatedAt
|
||||||
};
|
};
|
||||||
|
|
||||||
private static List<Blog> funcMain1(List<BlogSDto> p2)
|
private static List<Blog> funcMain1(List<BlogSDto> p2)
|
||||||
|
@ -205,6 +222,8 @@ namespace Netina.Domain.Mappers
|
||||||
Name = item.CategoryName,
|
Name = item.CategoryName,
|
||||||
Id = item.CategoryId
|
Id = item.CategoryId
|
||||||
},
|
},
|
||||||
|
AuthorId = item.AuthorId,
|
||||||
|
Author = new ApplicationUser() {Id = item.AuthorId},
|
||||||
Id = item.Id,
|
Id = item.Id,
|
||||||
CreatedAt = item.CreatedAt,
|
CreatedAt = item.CreatedAt,
|
||||||
ModifiedAt = item.ModifiedAt
|
ModifiedAt = item.ModifiedAt
|
||||||
|
@ -243,6 +262,8 @@ namespace Netina.Domain.Mappers
|
||||||
Name = item.CategoryName,
|
Name = item.CategoryName,
|
||||||
Id = item.CategoryId
|
Id = item.CategoryId
|
||||||
},
|
},
|
||||||
|
AuthorId = item.AuthorId,
|
||||||
|
Author = new ApplicationUser() {Id = item.AuthorId},
|
||||||
Id = item.Id,
|
Id = item.Id,
|
||||||
CreatedAt = item.CreatedAt,
|
CreatedAt = item.CreatedAt,
|
||||||
ModifiedAt = item.ModifiedAt
|
ModifiedAt = item.ModifiedAt
|
||||||
|
@ -279,6 +300,7 @@ namespace Netina.Domain.Mappers
|
||||||
CategoryName = item.Category == null ? null : item.Category.Name,
|
CategoryName = item.Category == null ? null : item.Category.Name,
|
||||||
MainImage = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
|
MainImage = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
|
||||||
ModifiedAt = item.ModifiedAt,
|
ModifiedAt = item.ModifiedAt,
|
||||||
|
AuthorId = item.AuthorId,
|
||||||
Id = item.Id,
|
Id = item.Id,
|
||||||
CreatedAt = item.CreatedAt
|
CreatedAt = item.CreatedAt
|
||||||
});
|
});
|
||||||
|
@ -314,6 +336,7 @@ namespace Netina.Domain.Mappers
|
||||||
CategoryName = item.Category == null ? null : item.Category.Name,
|
CategoryName = item.Category == null ? null : item.Category.Name,
|
||||||
MainImage = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
|
MainImage = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
|
||||||
ModifiedAt = item.ModifiedAt,
|
ModifiedAt = item.ModifiedAt,
|
||||||
|
AuthorId = item.AuthorId,
|
||||||
Id = item.Id,
|
Id = item.Id,
|
||||||
CreatedAt = item.CreatedAt
|
CreatedAt = item.CreatedAt
|
||||||
});
|
});
|
||||||
|
@ -323,14 +346,23 @@ namespace Netina.Domain.Mappers
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int funcMain7(int? p21)
|
private static BlogCategory funcMain7(Never p20, BlogCategory p21, BlogCategorySDto p18)
|
||||||
{
|
{
|
||||||
return p21 == null ? 0 : (int)p21;
|
BlogCategory result = p21 ?? new BlogCategory();
|
||||||
|
|
||||||
|
result.Id = p18.ParentId;
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int funcMain8(int? p24, int p25)
|
private static int funcMain8(int? p23)
|
||||||
{
|
{
|
||||||
return p24 == null ? 0 : (int)p24;
|
return p23 == null ? 0 : (int)p23;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int funcMain9(int? p26, int p27)
|
||||||
|
{
|
||||||
|
return p26 == null ? 0 : (int)p26;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool funcMain4(BlogStorageFile f)
|
private static bool funcMain4(BlogStorageFile f)
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Mapster.Models;
|
||||||
using Netina.Domain.Dtos.LargDtos;
|
using Netina.Domain.Dtos.LargDtos;
|
||||||
using Netina.Domain.Dtos.SmallDtos;
|
using Netina.Domain.Dtos.SmallDtos;
|
||||||
using Netina.Domain.Entities.Blogs;
|
using Netina.Domain.Entities.Blogs;
|
||||||
|
using Netina.Domain.Entities.Users;
|
||||||
|
|
||||||
namespace Netina.Domain.Mappers
|
namespace Netina.Domain.Mappers
|
||||||
{
|
{
|
||||||
|
@ -29,6 +30,8 @@ namespace Netina.Domain.Mappers
|
||||||
Id = p1.CategoryId
|
Id = p1.CategoryId
|
||||||
},
|
},
|
||||||
Files = funcMain1(p1.Files),
|
Files = funcMain1(p1.Files),
|
||||||
|
AuthorId = p1.AuthorId,
|
||||||
|
Author = new ApplicationUser() {Id = p1.AuthorId},
|
||||||
Id = p1.Id,
|
Id = p1.Id,
|
||||||
CreatedAt = p1.CreatedAt
|
CreatedAt = p1.CreatedAt
|
||||||
};
|
};
|
||||||
|
@ -51,206 +54,223 @@ namespace Netina.Domain.Mappers
|
||||||
result.CategoryId = p3.CategoryId;
|
result.CategoryId = p3.CategoryId;
|
||||||
result.Category = funcMain2(new Never(), result.Category, p3);
|
result.Category = funcMain2(new Never(), result.Category, p3);
|
||||||
result.Files = funcMain3(p3.Files, result.Files);
|
result.Files = funcMain3(p3.Files, result.Files);
|
||||||
|
result.AuthorId = p3.AuthorId;
|
||||||
|
result.Author = funcMain4(new Never(), result.Author, p3);
|
||||||
result.Id = p3.Id;
|
result.Id = p3.Id;
|
||||||
result.CreatedAt = p3.CreatedAt;
|
result.CreatedAt = p3.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Expression<Func<BlogLDto, Blog>> ProjectToBlog => p9 => new Blog()
|
public static Expression<Func<BlogLDto, Blog>> ProjectToBlog => p11 => new Blog()
|
||||||
{
|
{
|
||||||
Title = p9.Title,
|
Title = p11.Title,
|
||||||
Content = p9.Content,
|
Content = p11.Content,
|
||||||
Slug = p9.Slug,
|
Slug = p11.Slug,
|
||||||
Tags = p9.Tags,
|
Tags = p11.Tags,
|
||||||
ReadingTime = p9.ReadingTime,
|
ReadingTime = p11.ReadingTime,
|
||||||
Summery = p9.Summery,
|
Summery = p11.Summery,
|
||||||
IsSuggested = p9.IsSuggested,
|
IsSuggested = p11.IsSuggested,
|
||||||
CategoryId = p9.CategoryId,
|
CategoryId = p11.CategoryId,
|
||||||
Category = new BlogCategory()
|
Category = new BlogCategory()
|
||||||
{
|
{
|
||||||
Name = p9.CategoryName,
|
Name = p11.CategoryName,
|
||||||
Id = p9.CategoryId
|
Id = p11.CategoryId
|
||||||
},
|
},
|
||||||
Files = p9.Files.Select<StorageFileSDto, BlogStorageFile>(p10 => new BlogStorageFile()
|
Files = p11.Files.Select<StorageFileSDto, BlogStorageFile>(p12 => new BlogStorageFile()
|
||||||
{
|
{
|
||||||
Name = p10.Name,
|
Name = p12.Name,
|
||||||
FileLocation = p10.FileLocation,
|
FileLocation = p12.FileLocation,
|
||||||
FileName = p10.FileName,
|
FileName = p12.FileName,
|
||||||
IsHeader = p10.IsHeader,
|
IsHeader = p12.IsHeader,
|
||||||
IsPrimary = p10.IsPrimary,
|
IsPrimary = p12.IsPrimary,
|
||||||
FileType = p10.FileType,
|
FileType = p12.FileType,
|
||||||
Id = p10.Id,
|
Id = p12.Id,
|
||||||
CreatedAt = p10.CreatedAt
|
CreatedAt = p12.CreatedAt
|
||||||
}).ToList<BlogStorageFile>(),
|
}).ToList<BlogStorageFile>(),
|
||||||
Id = p9.Id,
|
AuthorId = p11.AuthorId,
|
||||||
CreatedAt = p9.CreatedAt
|
Author = new ApplicationUser() {Id = p11.AuthorId},
|
||||||
|
Id = p11.Id,
|
||||||
|
CreatedAt = p11.CreatedAt
|
||||||
};
|
};
|
||||||
public static BlogLDto AdaptToLDto(this Blog p11)
|
public static BlogLDto AdaptToLDto(this Blog p13)
|
||||||
{
|
{
|
||||||
return p11 == null ? null : new BlogLDto()
|
return p13 == null ? null : new BlogLDto()
|
||||||
{
|
{
|
||||||
Title = p11.Title,
|
Title = p13.Title,
|
||||||
Content = p11.Content,
|
Content = p13.Content,
|
||||||
Tags = p11.Tags,
|
Tags = p13.Tags,
|
||||||
Slug = p11.Slug,
|
Slug = p13.Slug,
|
||||||
ReadingTime = p11.ReadingTime,
|
ReadingTime = p13.ReadingTime,
|
||||||
Summery = p11.Summery,
|
Summery = p13.Summery,
|
||||||
MainImage = p11.Files.Count > 0 && p11.Files.Any<BlogStorageFile>(funcMain4) ? p11.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
|
MainImage = p13.Files.Count > 0 && p13.Files.Any<BlogStorageFile>(funcMain5) ? p13.Files.FirstOrDefault<BlogStorageFile>(funcMain6).FileName : string.Empty,
|
||||||
IsSuggested = p11.IsSuggested,
|
IsSuggested = p13.IsSuggested,
|
||||||
CategoryId = p11.CategoryId,
|
CategoryId = p13.CategoryId,
|
||||||
CategoryName = p11.Category == null ? null : p11.Category.Name,
|
CategoryName = p13.Category == null ? null : p13.Category.Name,
|
||||||
Files = funcMain6(p11.Files),
|
AuthorId = p13.AuthorId,
|
||||||
Id = p11.Id,
|
AuthorFullName = p13.Author != null ? p13.Author.FirstName + " " + p13.Author.LastName : string.Empty,
|
||||||
CreatedAt = p11.CreatedAt
|
Files = funcMain7(p13.Files),
|
||||||
|
Id = p13.Id,
|
||||||
|
CreatedAt = p13.CreatedAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static BlogLDto AdaptTo(this Blog p13, BlogLDto p14)
|
public static BlogLDto AdaptTo(this Blog p15, BlogLDto p16)
|
||||||
{
|
{
|
||||||
if (p13 == null)
|
if (p15 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlogLDto result = p14 ?? new BlogLDto();
|
BlogLDto result = p16 ?? new BlogLDto();
|
||||||
|
|
||||||
result.Title = p13.Title;
|
result.Title = p15.Title;
|
||||||
result.Content = p13.Content;
|
result.Content = p15.Content;
|
||||||
result.Tags = p13.Tags;
|
result.Tags = p15.Tags;
|
||||||
result.Slug = p13.Slug;
|
result.Slug = p15.Slug;
|
||||||
result.ReadingTime = p13.ReadingTime;
|
result.ReadingTime = p15.ReadingTime;
|
||||||
result.Summery = p13.Summery;
|
result.Summery = p15.Summery;
|
||||||
result.MainImage = p13.Files.Count > 0 && p13.Files.Any<BlogStorageFile>(funcMain4) ? p13.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty;
|
result.MainImage = p15.Files.Count > 0 && p15.Files.Any<BlogStorageFile>(funcMain5) ? p15.Files.FirstOrDefault<BlogStorageFile>(funcMain6).FileName : string.Empty;
|
||||||
result.IsSuggested = p13.IsSuggested;
|
result.IsSuggested = p15.IsSuggested;
|
||||||
result.CategoryId = p13.CategoryId;
|
result.CategoryId = p15.CategoryId;
|
||||||
result.CategoryName = p13.Category == null ? null : p13.Category.Name;
|
result.CategoryName = p15.Category == null ? null : p15.Category.Name;
|
||||||
result.Files = funcMain7(p13.Files, result.Files);
|
result.AuthorId = p15.AuthorId;
|
||||||
result.Id = p13.Id;
|
result.AuthorFullName = p15.Author != null ? p15.Author.FirstName + " " + p15.Author.LastName : string.Empty;
|
||||||
result.CreatedAt = p13.CreatedAt;
|
result.Files = funcMain8(p15.Files, result.Files);
|
||||||
|
result.Id = p15.Id;
|
||||||
|
result.CreatedAt = p15.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Expression<Func<Blog, BlogLDto>> ProjectToLDto => p17 => new BlogLDto()
|
public static Expression<Func<Blog, BlogLDto>> ProjectToLDto => p19 => new BlogLDto()
|
||||||
{
|
{
|
||||||
Title = p17.Title,
|
Title = p19.Title,
|
||||||
Content = p17.Content,
|
Content = p19.Content,
|
||||||
Tags = p17.Tags,
|
Tags = p19.Tags,
|
||||||
Slug = p17.Slug,
|
Slug = p19.Slug,
|
||||||
ReadingTime = p17.ReadingTime,
|
ReadingTime = p19.ReadingTime,
|
||||||
Summery = p17.Summery,
|
Summery = p19.Summery,
|
||||||
MainImage = p17.Files.Count > 0 && p17.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p17.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
MainImage = p19.Files.Count > 0 && p19.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p19.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||||
IsSuggested = p17.IsSuggested,
|
IsSuggested = p19.IsSuggested,
|
||||||
CategoryId = p17.CategoryId,
|
CategoryId = p19.CategoryId,
|
||||||
CategoryName = p17.Category.Name,
|
CategoryName = p19.Category.Name,
|
||||||
Files = p17.Files.Select<BlogStorageFile, StorageFileSDto>(p18 => new StorageFileSDto()
|
AuthorId = p19.AuthorId,
|
||||||
|
AuthorFullName = p19.Author != null ? p19.Author.FirstName + " " + p19.Author.LastName : string.Empty,
|
||||||
|
Files = p19.Files.Select<BlogStorageFile, StorageFileSDto>(p20 => new StorageFileSDto()
|
||||||
{
|
{
|
||||||
Name = p18.Name,
|
Name = p20.Name,
|
||||||
FileLocation = p18.FileLocation,
|
FileLocation = p20.FileLocation,
|
||||||
FileName = p18.FileName,
|
FileName = p20.FileName,
|
||||||
IsHeader = p18.IsHeader,
|
IsHeader = p20.IsHeader,
|
||||||
IsPrimary = p18.IsPrimary,
|
IsPrimary = p20.IsPrimary,
|
||||||
FileType = p18.FileType,
|
FileType = p20.FileType,
|
||||||
Id = p18.Id
|
Id = p20.Id
|
||||||
}).ToList<StorageFileSDto>(),
|
}).ToList<StorageFileSDto>(),
|
||||||
Id = p17.Id,
|
Id = p19.Id,
|
||||||
CreatedAt = p17.CreatedAt
|
CreatedAt = p19.CreatedAt
|
||||||
};
|
};
|
||||||
public static Blog AdaptToBlog(this BlogSDto p19)
|
public static Blog AdaptToBlog(this BlogSDto p21)
|
||||||
{
|
{
|
||||||
return p19 == null ? null : new Blog()
|
return p21 == null ? null : new Blog()
|
||||||
{
|
{
|
||||||
Title = p19.Title,
|
Title = p21.Title,
|
||||||
Slug = p19.Slug,
|
Slug = p21.Slug,
|
||||||
Tags = p19.Tags,
|
Tags = p21.Tags,
|
||||||
ReadingTime = p19.ReadingTime,
|
ReadingTime = p21.ReadingTime,
|
||||||
Summery = p19.Summery,
|
Summery = p21.Summery,
|
||||||
IsSuggested = p19.IsSuggested,
|
IsSuggested = p21.IsSuggested,
|
||||||
CategoryId = p19.CategoryId,
|
CategoryId = p21.CategoryId,
|
||||||
Category = new BlogCategory()
|
Category = new BlogCategory()
|
||||||
{
|
{
|
||||||
Name = p19.CategoryName,
|
Name = p21.CategoryName,
|
||||||
Id = p19.CategoryId
|
Id = p21.CategoryId
|
||||||
},
|
},
|
||||||
Id = p19.Id,
|
AuthorId = p21.AuthorId,
|
||||||
CreatedAt = p19.CreatedAt,
|
Author = new ApplicationUser() {Id = p21.AuthorId},
|
||||||
ModifiedAt = p19.ModifiedAt
|
Id = p21.Id,
|
||||||
|
CreatedAt = p21.CreatedAt,
|
||||||
|
ModifiedAt = p21.ModifiedAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Blog AdaptTo(this BlogSDto p20, Blog p21)
|
public static Blog AdaptTo(this BlogSDto p22, Blog p23)
|
||||||
{
|
{
|
||||||
if (p20 == null)
|
if (p22 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Blog result = p21 ?? new Blog();
|
Blog result = p23 ?? new Blog();
|
||||||
|
|
||||||
result.Title = p20.Title;
|
result.Title = p22.Title;
|
||||||
result.Slug = p20.Slug;
|
result.Slug = p22.Slug;
|
||||||
result.Tags = p20.Tags;
|
result.Tags = p22.Tags;
|
||||||
result.ReadingTime = p20.ReadingTime;
|
result.ReadingTime = p22.ReadingTime;
|
||||||
result.Summery = p20.Summery;
|
result.Summery = p22.Summery;
|
||||||
result.IsSuggested = p20.IsSuggested;
|
result.IsSuggested = p22.IsSuggested;
|
||||||
result.CategoryId = p20.CategoryId;
|
result.CategoryId = p22.CategoryId;
|
||||||
result.Category = funcMain8(new Never(), result.Category, p20);
|
result.Category = funcMain9(new Never(), result.Category, p22);
|
||||||
result.Id = p20.Id;
|
result.AuthorId = p22.AuthorId;
|
||||||
result.CreatedAt = p20.CreatedAt;
|
result.Author = funcMain10(new Never(), result.Author, p22);
|
||||||
result.ModifiedAt = p20.ModifiedAt;
|
result.Id = p22.Id;
|
||||||
|
result.CreatedAt = p22.CreatedAt;
|
||||||
|
result.ModifiedAt = p22.ModifiedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static BlogSDto AdaptToSDto(this Blog p24)
|
public static BlogSDto AdaptToSDto(this Blog p28)
|
||||||
{
|
{
|
||||||
return p24 == null ? null : new BlogSDto()
|
return p28 == null ? null : new BlogSDto()
|
||||||
{
|
{
|
||||||
Title = p24.Title,
|
Title = p28.Title,
|
||||||
Slug = p24.Slug,
|
Slug = p28.Slug,
|
||||||
Tags = p24.Tags,
|
Tags = p28.Tags,
|
||||||
ReadingTime = p24.ReadingTime,
|
ReadingTime = p28.ReadingTime,
|
||||||
Summery = p24.Summery,
|
Summery = p28.Summery,
|
||||||
IsSuggested = p24.IsSuggested,
|
IsSuggested = p28.IsSuggested,
|
||||||
CategoryId = p24.CategoryId,
|
CategoryId = p28.CategoryId,
|
||||||
CategoryName = p24.Category == null ? null : p24.Category.Name,
|
CategoryName = p28.Category == null ? null : p28.Category.Name,
|
||||||
MainImage = p24.Files.Count > 0 && p24.Files.Any<BlogStorageFile>(funcMain9) ? p24.Files.FirstOrDefault<BlogStorageFile>(funcMain10).FileName : string.Empty,
|
MainImage = p28.Files.Count > 0 && p28.Files.Any<BlogStorageFile>(funcMain11) ? p28.Files.FirstOrDefault<BlogStorageFile>(funcMain12).FileName : string.Empty,
|
||||||
ModifiedAt = p24.ModifiedAt,
|
ModifiedAt = p28.ModifiedAt,
|
||||||
Id = p24.Id,
|
AuthorId = p28.AuthorId,
|
||||||
CreatedAt = p24.CreatedAt
|
Id = p28.Id,
|
||||||
|
CreatedAt = p28.CreatedAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static BlogSDto AdaptTo(this Blog p25, BlogSDto p26)
|
public static BlogSDto AdaptTo(this Blog p29, BlogSDto p30)
|
||||||
{
|
{
|
||||||
if (p25 == null)
|
if (p29 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlogSDto result = p26 ?? new BlogSDto();
|
BlogSDto result = p30 ?? new BlogSDto();
|
||||||
|
|
||||||
result.Title = p25.Title;
|
result.Title = p29.Title;
|
||||||
result.Slug = p25.Slug;
|
result.Slug = p29.Slug;
|
||||||
result.Tags = p25.Tags;
|
result.Tags = p29.Tags;
|
||||||
result.ReadingTime = p25.ReadingTime;
|
result.ReadingTime = p29.ReadingTime;
|
||||||
result.Summery = p25.Summery;
|
result.Summery = p29.Summery;
|
||||||
result.IsSuggested = p25.IsSuggested;
|
result.IsSuggested = p29.IsSuggested;
|
||||||
result.CategoryId = p25.CategoryId;
|
result.CategoryId = p29.CategoryId;
|
||||||
result.CategoryName = p25.Category == null ? null : p25.Category.Name;
|
result.CategoryName = p29.Category == null ? null : p29.Category.Name;
|
||||||
result.MainImage = p25.Files.Count > 0 && p25.Files.Any<BlogStorageFile>(funcMain9) ? p25.Files.FirstOrDefault<BlogStorageFile>(funcMain10).FileName : string.Empty;
|
result.MainImage = p29.Files.Count > 0 && p29.Files.Any<BlogStorageFile>(funcMain11) ? p29.Files.FirstOrDefault<BlogStorageFile>(funcMain12).FileName : string.Empty;
|
||||||
result.ModifiedAt = p25.ModifiedAt;
|
result.ModifiedAt = p29.ModifiedAt;
|
||||||
result.Id = p25.Id;
|
result.AuthorId = p29.AuthorId;
|
||||||
result.CreatedAt = p25.CreatedAt;
|
result.Id = p29.Id;
|
||||||
|
result.CreatedAt = p29.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Expression<Func<Blog, BlogSDto>> ProjectToSDto => p27 => new BlogSDto()
|
public static Expression<Func<Blog, BlogSDto>> ProjectToSDto => p31 => new BlogSDto()
|
||||||
{
|
{
|
||||||
Title = p27.Title,
|
Title = p31.Title,
|
||||||
Slug = p27.Slug,
|
Slug = p31.Slug,
|
||||||
Tags = p27.Tags,
|
Tags = p31.Tags,
|
||||||
ReadingTime = p27.ReadingTime,
|
ReadingTime = p31.ReadingTime,
|
||||||
Summery = p27.Summery,
|
Summery = p31.Summery,
|
||||||
IsSuggested = p27.IsSuggested,
|
IsSuggested = p31.IsSuggested,
|
||||||
CategoryId = p27.CategoryId,
|
CategoryId = p31.CategoryId,
|
||||||
CategoryName = p27.Category.Name,
|
CategoryName = p31.Category.Name,
|
||||||
MainImage = p27.Files.Count > 0 && p27.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p27.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
MainImage = p31.Files.Count > 0 && p31.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p31.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||||
ModifiedAt = p27.ModifiedAt,
|
ModifiedAt = p31.ModifiedAt,
|
||||||
Id = p27.Id,
|
AuthorId = p31.AuthorId,
|
||||||
CreatedAt = p27.CreatedAt
|
Id = p31.Id,
|
||||||
|
CreatedAt = p31.CreatedAt
|
||||||
};
|
};
|
||||||
|
|
||||||
private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2)
|
private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||||
|
@ -325,9 +345,13 @@ namespace Netina.Domain.Mappers
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool funcMain4(BlogStorageFile f)
|
private static ApplicationUser funcMain4(Never p9, ApplicationUser p10, BlogLDto p3)
|
||||||
{
|
{
|
||||||
return f.IsPrimary;
|
ApplicationUser result = p10 ?? new ApplicationUser();
|
||||||
|
|
||||||
|
result.Id = p3.AuthorId;
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool funcMain5(BlogStorageFile f)
|
private static bool funcMain5(BlogStorageFile f)
|
||||||
|
@ -335,82 +359,96 @@ namespace Netina.Domain.Mappers
|
||||||
return f.IsPrimary;
|
return f.IsPrimary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<StorageFileSDto> funcMain6(List<BlogStorageFile> p12)
|
private static bool funcMain6(BlogStorageFile f)
|
||||||
{
|
|
||||||
if (p12 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p12.Count);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int len = p12.Count;
|
|
||||||
|
|
||||||
while (i < len)
|
|
||||||
{
|
|
||||||
BlogStorageFile item = p12[i];
|
|
||||||
result.Add(item == null ? null : new StorageFileSDto()
|
|
||||||
{
|
|
||||||
Name = item.Name,
|
|
||||||
FileLocation = item.FileLocation,
|
|
||||||
FileName = item.FileName,
|
|
||||||
IsHeader = item.IsHeader,
|
|
||||||
IsPrimary = item.IsPrimary,
|
|
||||||
FileType = item.FileType,
|
|
||||||
Id = item.Id
|
|
||||||
});
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<StorageFileSDto> funcMain7(List<BlogStorageFile> p15, List<StorageFileSDto> p16)
|
|
||||||
{
|
|
||||||
if (p15 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p15.Count);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int len = p15.Count;
|
|
||||||
|
|
||||||
while (i < len)
|
|
||||||
{
|
|
||||||
BlogStorageFile item = p15[i];
|
|
||||||
result.Add(item == null ? null : new StorageFileSDto()
|
|
||||||
{
|
|
||||||
Name = item.Name,
|
|
||||||
FileLocation = item.FileLocation,
|
|
||||||
FileName = item.FileName,
|
|
||||||
IsHeader = item.IsHeader,
|
|
||||||
IsPrimary = item.IsPrimary,
|
|
||||||
FileType = item.FileType,
|
|
||||||
Id = item.Id
|
|
||||||
});
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BlogCategory funcMain8(Never p22, BlogCategory p23, BlogSDto p20)
|
|
||||||
{
|
|
||||||
BlogCategory result = p23 ?? new BlogCategory();
|
|
||||||
|
|
||||||
result.Name = p20.CategoryName;
|
|
||||||
result.Id = p20.CategoryId;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool funcMain9(BlogStorageFile f)
|
|
||||||
{
|
{
|
||||||
return f.IsPrimary;
|
return f.IsPrimary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool funcMain10(BlogStorageFile f)
|
private static List<StorageFileSDto> funcMain7(List<BlogStorageFile> p14)
|
||||||
|
{
|
||||||
|
if (p14 == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<StorageFileSDto> result = new List<StorageFileSDto>(p14.Count);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
int len = p14.Count;
|
||||||
|
|
||||||
|
while (i < len)
|
||||||
|
{
|
||||||
|
BlogStorageFile item = p14[i];
|
||||||
|
result.Add(item == null ? null : new StorageFileSDto()
|
||||||
|
{
|
||||||
|
Name = item.Name,
|
||||||
|
FileLocation = item.FileLocation,
|
||||||
|
FileName = item.FileName,
|
||||||
|
IsHeader = item.IsHeader,
|
||||||
|
IsPrimary = item.IsPrimary,
|
||||||
|
FileType = item.FileType,
|
||||||
|
Id = item.Id
|
||||||
|
});
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<StorageFileSDto> funcMain8(List<BlogStorageFile> p17, List<StorageFileSDto> p18)
|
||||||
|
{
|
||||||
|
if (p17 == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<StorageFileSDto> result = new List<StorageFileSDto>(p17.Count);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
int len = p17.Count;
|
||||||
|
|
||||||
|
while (i < len)
|
||||||
|
{
|
||||||
|
BlogStorageFile item = p17[i];
|
||||||
|
result.Add(item == null ? null : new StorageFileSDto()
|
||||||
|
{
|
||||||
|
Name = item.Name,
|
||||||
|
FileLocation = item.FileLocation,
|
||||||
|
FileName = item.FileName,
|
||||||
|
IsHeader = item.IsHeader,
|
||||||
|
IsPrimary = item.IsPrimary,
|
||||||
|
FileType = item.FileType,
|
||||||
|
Id = item.Id
|
||||||
|
});
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BlogCategory funcMain9(Never p24, BlogCategory p25, BlogSDto p22)
|
||||||
|
{
|
||||||
|
BlogCategory result = p25 ?? new BlogCategory();
|
||||||
|
|
||||||
|
result.Name = p22.CategoryName;
|
||||||
|
result.Id = p22.CategoryId;
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ApplicationUser funcMain10(Never p26, ApplicationUser p27, BlogSDto p22)
|
||||||
|
{
|
||||||
|
ApplicationUser result = p27 ?? new ApplicationUser();
|
||||||
|
|
||||||
|
result.Id = p22.AuthorId;
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool funcMain11(BlogStorageFile f)
|
||||||
|
{
|
||||||
|
return f.IsPrimary;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool funcMain12(BlogStorageFile f)
|
||||||
{
|
{
|
||||||
return f.IsPrimary;
|
return f.IsPrimary;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace Netina.Domain.Mappers
|
||||||
{
|
{
|
||||||
PersianName = p1.PersianName,
|
PersianName = p1.PersianName,
|
||||||
EnglishName = p1.EnglishName,
|
EnglishName = p1.EnglishName,
|
||||||
|
Slug = p1.Slug,
|
||||||
Description = p1.Description,
|
Description = p1.Description,
|
||||||
HasSpecialPage = p1.HasSpecialPage,
|
HasSpecialPage = p1.HasSpecialPage,
|
||||||
PageUrl = p1.PageUrl,
|
PageUrl = p1.PageUrl,
|
||||||
|
@ -34,6 +35,7 @@ namespace Netina.Domain.Mappers
|
||||||
|
|
||||||
result.PersianName = p3.PersianName;
|
result.PersianName = p3.PersianName;
|
||||||
result.EnglishName = p3.EnglishName;
|
result.EnglishName = p3.EnglishName;
|
||||||
|
result.Slug = p3.Slug;
|
||||||
result.Description = p3.Description;
|
result.Description = p3.Description;
|
||||||
result.HasSpecialPage = p3.HasSpecialPage;
|
result.HasSpecialPage = p3.HasSpecialPage;
|
||||||
result.PageUrl = p3.PageUrl;
|
result.PageUrl = p3.PageUrl;
|
||||||
|
@ -47,6 +49,7 @@ namespace Netina.Domain.Mappers
|
||||||
{
|
{
|
||||||
PersianName = p7.PersianName,
|
PersianName = p7.PersianName,
|
||||||
EnglishName = p7.EnglishName,
|
EnglishName = p7.EnglishName,
|
||||||
|
Slug = p7.Slug,
|
||||||
Description = p7.Description,
|
Description = p7.Description,
|
||||||
HasSpecialPage = p7.HasSpecialPage,
|
HasSpecialPage = p7.HasSpecialPage,
|
||||||
PageUrl = p7.PageUrl,
|
PageUrl = p7.PageUrl,
|
||||||
|
@ -72,6 +75,7 @@ namespace Netina.Domain.Mappers
|
||||||
EnglishName = p9.EnglishName,
|
EnglishName = p9.EnglishName,
|
||||||
Description = p9.Description,
|
Description = p9.Description,
|
||||||
HasSpecialPage = p9.HasSpecialPage,
|
HasSpecialPage = p9.HasSpecialPage,
|
||||||
|
Slug = p9.Slug,
|
||||||
PageUrl = p9.PageUrl,
|
PageUrl = p9.PageUrl,
|
||||||
Files = funcMain3(p9.Files),
|
Files = funcMain3(p9.Files),
|
||||||
Id = p9.Id,
|
Id = p9.Id,
|
||||||
|
@ -90,6 +94,7 @@ namespace Netina.Domain.Mappers
|
||||||
result.EnglishName = p11.EnglishName;
|
result.EnglishName = p11.EnglishName;
|
||||||
result.Description = p11.Description;
|
result.Description = p11.Description;
|
||||||
result.HasSpecialPage = p11.HasSpecialPage;
|
result.HasSpecialPage = p11.HasSpecialPage;
|
||||||
|
result.Slug = p11.Slug;
|
||||||
result.PageUrl = p11.PageUrl;
|
result.PageUrl = p11.PageUrl;
|
||||||
result.Files = funcMain4(p11.Files, result.Files);
|
result.Files = funcMain4(p11.Files, result.Files);
|
||||||
result.Id = p11.Id;
|
result.Id = p11.Id;
|
||||||
|
@ -103,6 +108,7 @@ namespace Netina.Domain.Mappers
|
||||||
EnglishName = p15.EnglishName,
|
EnglishName = p15.EnglishName,
|
||||||
Description = p15.Description,
|
Description = p15.Description,
|
||||||
HasSpecialPage = p15.HasSpecialPage,
|
HasSpecialPage = p15.HasSpecialPage,
|
||||||
|
Slug = p15.Slug,
|
||||||
PageUrl = p15.PageUrl,
|
PageUrl = p15.PageUrl,
|
||||||
Files = p15.Files.Select<BrandStorageFile, StorageFileSDto>(p16 => new StorageFileSDto()
|
Files = p15.Files.Select<BrandStorageFile, StorageFileSDto>(p16 => new StorageFileSDto()
|
||||||
{
|
{
|
||||||
|
@ -123,6 +129,7 @@ namespace Netina.Domain.Mappers
|
||||||
{
|
{
|
||||||
PersianName = p17.PersianName,
|
PersianName = p17.PersianName,
|
||||||
EnglishName = p17.EnglishName,
|
EnglishName = p17.EnglishName,
|
||||||
|
Slug = p17.Slug,
|
||||||
Description = p17.Description,
|
Description = p17.Description,
|
||||||
HasSpecialPage = p17.HasSpecialPage,
|
HasSpecialPage = p17.HasSpecialPage,
|
||||||
PageUrl = p17.PageUrl,
|
PageUrl = p17.PageUrl,
|
||||||
|
@ -140,6 +147,7 @@ namespace Netina.Domain.Mappers
|
||||||
|
|
||||||
result.PersianName = p18.PersianName;
|
result.PersianName = p18.PersianName;
|
||||||
result.EnglishName = p18.EnglishName;
|
result.EnglishName = p18.EnglishName;
|
||||||
|
result.Slug = p18.Slug;
|
||||||
result.Description = p18.Description;
|
result.Description = p18.Description;
|
||||||
result.HasSpecialPage = p18.HasSpecialPage;
|
result.HasSpecialPage = p18.HasSpecialPage;
|
||||||
result.PageUrl = p18.PageUrl;
|
result.PageUrl = p18.PageUrl;
|
||||||
|
@ -155,6 +163,7 @@ namespace Netina.Domain.Mappers
|
||||||
PersianName = p20.PersianName,
|
PersianName = p20.PersianName,
|
||||||
EnglishName = p20.EnglishName,
|
EnglishName = p20.EnglishName,
|
||||||
Description = p20.Description,
|
Description = p20.Description,
|
||||||
|
Slug = p20.Slug,
|
||||||
HasSpecialPage = p20.HasSpecialPage,
|
HasSpecialPage = p20.HasSpecialPage,
|
||||||
PageUrl = p20.PageUrl,
|
PageUrl = p20.PageUrl,
|
||||||
Id = p20.Id,
|
Id = p20.Id,
|
||||||
|
@ -172,6 +181,7 @@ namespace Netina.Domain.Mappers
|
||||||
result.PersianName = p21.PersianName;
|
result.PersianName = p21.PersianName;
|
||||||
result.EnglishName = p21.EnglishName;
|
result.EnglishName = p21.EnglishName;
|
||||||
result.Description = p21.Description;
|
result.Description = p21.Description;
|
||||||
|
result.Slug = p21.Slug;
|
||||||
result.HasSpecialPage = p21.HasSpecialPage;
|
result.HasSpecialPage = p21.HasSpecialPage;
|
||||||
result.PageUrl = p21.PageUrl;
|
result.PageUrl = p21.PageUrl;
|
||||||
result.Id = p21.Id;
|
result.Id = p21.Id;
|
||||||
|
@ -184,6 +194,7 @@ namespace Netina.Domain.Mappers
|
||||||
PersianName = p23.PersianName,
|
PersianName = p23.PersianName,
|
||||||
EnglishName = p23.EnglishName,
|
EnglishName = p23.EnglishName,
|
||||||
Description = p23.Description,
|
Description = p23.Description,
|
||||||
|
Slug = p23.Slug,
|
||||||
HasSpecialPage = p23.HasSpecialPage,
|
HasSpecialPage = p23.HasSpecialPage,
|
||||||
PageUrl = p23.PageUrl,
|
PageUrl = p23.PageUrl,
|
||||||
Id = p23.Id,
|
Id = p23.Id,
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace Netina.Domain.Mappers
|
||||||
return p1 == null ? null : new ProductCategory()
|
return p1 == null ? null : new ProductCategory()
|
||||||
{
|
{
|
||||||
Name = p1.Name,
|
Name = p1.Name,
|
||||||
|
Slug = p1.Slug,
|
||||||
Description = p1.Description,
|
Description = p1.Description,
|
||||||
IsMain = p1.IsMain,
|
IsMain = p1.IsMain,
|
||||||
ParentId = (Guid?)p1.ParentId,
|
ParentId = (Guid?)p1.ParentId,
|
||||||
|
@ -38,6 +39,7 @@ namespace Netina.Domain.Mappers
|
||||||
ProductCategory result = p4 ?? new ProductCategory();
|
ProductCategory result = p4 ?? new ProductCategory();
|
||||||
|
|
||||||
result.Name = p3.Name;
|
result.Name = p3.Name;
|
||||||
|
result.Slug = p3.Slug;
|
||||||
result.Description = p3.Description;
|
result.Description = p3.Description;
|
||||||
result.IsMain = p3.IsMain;
|
result.IsMain = p3.IsMain;
|
||||||
result.ParentId = (Guid?)p3.ParentId;
|
result.ParentId = (Guid?)p3.ParentId;
|
||||||
|
@ -51,6 +53,7 @@ namespace Netina.Domain.Mappers
|
||||||
public static Expression<Func<ProductCategoryLDto, ProductCategory>> ProjectToProductCategory => p9 => new ProductCategory()
|
public static Expression<Func<ProductCategoryLDto, ProductCategory>> ProjectToProductCategory => p9 => new ProductCategory()
|
||||||
{
|
{
|
||||||
Name = p9.Name,
|
Name = p9.Name,
|
||||||
|
Slug = p9.Slug,
|
||||||
Description = p9.Description,
|
Description = p9.Description,
|
||||||
IsMain = p9.IsMain,
|
IsMain = p9.IsMain,
|
||||||
ParentId = (Guid?)p9.ParentId,
|
ParentId = (Guid?)p9.ParentId,
|
||||||
|
@ -81,6 +84,7 @@ namespace Netina.Domain.Mappers
|
||||||
Description = p11.Description,
|
Description = p11.Description,
|
||||||
ParentId = p11.ParentId == null ? default(Guid) : (Guid)p11.ParentId,
|
ParentId = p11.ParentId == null ? default(Guid) : (Guid)p11.ParentId,
|
||||||
ParentName = p11.Parent != null ? p11.Parent.Name : string.Empty,
|
ParentName = p11.Parent != null ? p11.Parent.Name : string.Empty,
|
||||||
|
Slug = p11.Slug,
|
||||||
IsMain = p11.IsMain,
|
IsMain = p11.IsMain,
|
||||||
Files = funcMain4(p11.Files),
|
Files = funcMain4(p11.Files),
|
||||||
Id = p11.Id,
|
Id = p11.Id,
|
||||||
|
@ -99,6 +103,7 @@ namespace Netina.Domain.Mappers
|
||||||
result.Description = p13.Description;
|
result.Description = p13.Description;
|
||||||
result.ParentId = p13.ParentId == null ? default(Guid) : (Guid)p13.ParentId;
|
result.ParentId = p13.ParentId == null ? default(Guid) : (Guid)p13.ParentId;
|
||||||
result.ParentName = p13.Parent != null ? p13.Parent.Name : string.Empty;
|
result.ParentName = p13.Parent != null ? p13.Parent.Name : string.Empty;
|
||||||
|
result.Slug = p13.Slug;
|
||||||
result.IsMain = p13.IsMain;
|
result.IsMain = p13.IsMain;
|
||||||
result.Files = funcMain5(p13.Files, result.Files);
|
result.Files = funcMain5(p13.Files, result.Files);
|
||||||
result.Id = p13.Id;
|
result.Id = p13.Id;
|
||||||
|
@ -112,6 +117,7 @@ namespace Netina.Domain.Mappers
|
||||||
Description = p17.Description,
|
Description = p17.Description,
|
||||||
ParentId = p17.ParentId == null ? default(Guid) : (Guid)p17.ParentId,
|
ParentId = p17.ParentId == null ? default(Guid) : (Guid)p17.ParentId,
|
||||||
ParentName = p17.Parent != null ? p17.Parent.Name : string.Empty,
|
ParentName = p17.Parent != null ? p17.Parent.Name : string.Empty,
|
||||||
|
Slug = p17.Slug,
|
||||||
IsMain = p17.IsMain,
|
IsMain = p17.IsMain,
|
||||||
Files = p17.Files.Select<ProductCategoryStorageFile, StorageFileSDto>(p18 => new StorageFileSDto()
|
Files = p17.Files.Select<ProductCategoryStorageFile, StorageFileSDto>(p18 => new StorageFileSDto()
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,8 +2,7 @@ using System;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Netina.Domain.Dtos.LargDtos;
|
using Netina.Domain.Dtos.LargDtos;
|
||||||
using Netina.Domain.Dtos.SmallDtos;
|
using Netina.Domain.Dtos.SmallDtos;
|
||||||
using Netina.Domain.Entities.Products;
|
using Netina.Domain.Entities.Reviews;
|
||||||
using Review = Netina.Domain.Entities.Reviews.Review;
|
|
||||||
|
|
||||||
namespace Netina.Domain.Mappers
|
namespace Netina.Domain.Mappers
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class MapsterRegister : IRegister
|
||||||
.TwoWays();
|
.TwoWays();
|
||||||
|
|
||||||
config.NewConfig<Blog, BlogLDto>()
|
config.NewConfig<Blog, BlogLDto>()
|
||||||
|
.Map(o=>o.AuthorFullName , d=>d.Author!=null ? d.Author.FirstName + " " + d.Author.LastName : string.Empty)
|
||||||
.Map("MainImage", o => o.Files.Count > 0 && o.Files.Any(f => f.IsPrimary) ? o.Files.FirstOrDefault(f => f.IsPrimary)!.FileName : string.Empty)
|
.Map("MainImage", o => o.Files.Count > 0 && o.Files.Any(f => f.IsPrimary) ? o.Files.FirstOrDefault(f => f.IsPrimary)!.FileName : string.Empty)
|
||||||
.TwoWays();
|
.TwoWays();
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ public class MapsterRegister : IRegister
|
||||||
.TwoWays();
|
.TwoWays();
|
||||||
|
|
||||||
config.NewConfig<Product, ProductSDto>()
|
config.NewConfig<Product, ProductSDto>()
|
||||||
|
.Map(o => o.AuthorFullName, d => d.Author != null ? d.Author.FirstName + " " + d.Author.LastName : string.Empty)
|
||||||
.Map("MainImage", o => o.Files.FirstOrDefault(f => f.IsPrimary) != null ? o.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : o.Files.Count > 0 ? o.Files.FirstOrDefault().FileLocation : string.Empty)
|
.Map("MainImage", o => o.Files.FirstOrDefault(f => f.IsPrimary) != null ? o.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : o.Files.Count > 0 ? o.Files.FirstOrDefault().FileLocation : string.Empty)
|
||||||
.Map("CategoryName", o => o.Category == null ? null : o.Category.Name)
|
.Map("CategoryName", o => o.Category == null ? null : o.Category.Name)
|
||||||
.Map("BrandName", o => o.Brand == null ? null : o.Brand.PersianName)
|
.Map("BrandName", o => o.Brand == null ? null : o.Brand.PersianName)
|
||||||
|
@ -53,14 +55,12 @@ public class MapsterRegister : IRegister
|
||||||
|
|
||||||
|
|
||||||
config.NewConfig<Product, ProductLDto>()
|
config.NewConfig<Product, ProductLDto>()
|
||||||
|
.Map(o => o.AuthorFullName, d => d.Author != null ? d.Author.FirstName + " " + d.Author.LastName : string.Empty)
|
||||||
.Map("CategoryName", o => o.Category == null ? null : o.Category.Name)
|
.Map("CategoryName", o => o.Category == null ? null : o.Category.Name)
|
||||||
.Map("BrandName", o => o.Brand == null ? null : o.Brand.PersianName)
|
.Map("BrandName", o => o.Brand == null ? null : o.Brand.PersianName)
|
||||||
.IgnoreNullValues(false)
|
.IgnoreNullValues(false)
|
||||||
.TwoWays();
|
.TwoWays();
|
||||||
config.NewConfig<Product, ProductSDto>()
|
|
||||||
.Map("MainImage", o => o.Files.FirstOrDefault(f => f.IsPrimary) != null ? o.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : o.Files.Count > 0 ? o.Files.FirstOrDefault().FileLocation : string.Empty)
|
|
||||||
.IgnoreNullValues(false)
|
|
||||||
.TwoWays();
|
|
||||||
config.NewConfig<Product, TorobProductResponseDto>()
|
config.NewConfig<Product, TorobProductResponseDto>()
|
||||||
.Map(s=>s.availibility,o=>o.IsEnable)
|
.Map(s=>s.availibility,o=>o.IsEnable)
|
||||||
.Map(s=>s.price , o=>o.Cost)
|
.Map(s=>s.price , o=>o.Cost)
|
||||||
|
|
|
@ -15,7 +15,8 @@ public class ChangeProductCostCommandHandler(IRepositoryWrapper repositoryWrappe
|
||||||
ent.Warranty,
|
ent.Warranty,
|
||||||
ent.BeDisplayed, request.Cost, ent.PackingCost, ent.HasExpressDelivery, ent.Stock, ent.MaxOrderCount,
|
ent.BeDisplayed, request.Cost, ent.PackingCost, ent.HasExpressDelivery, ent.Stock, ent.MaxOrderCount,
|
||||||
ent.BrandId,
|
ent.BrandId,
|
||||||
ent.CategoryId);
|
ent.CategoryId,
|
||||||
|
ent.AuthorId);
|
||||||
newEnt.CreatedAt = ent.CreatedAt;
|
newEnt.CreatedAt = ent.CreatedAt;
|
||||||
newEnt.CreatedBy = ent.CreatedBy;
|
newEnt.CreatedBy = ent.CreatedBy;
|
||||||
newEnt.Id = ent.Id;
|
newEnt.Id = ent.Id;
|
||||||
|
|
|
@ -14,7 +14,8 @@ public class ChangeProductDisplayedCommandHandler(IRepositoryWrapper repositoryW
|
||||||
ent.Warranty,
|
ent.Warranty,
|
||||||
request.BeDisplayed, ent.Cost, ent.PackingCost, ent.HasExpressDelivery, ent.Stock, ent.MaxOrderCount,
|
request.BeDisplayed, ent.Cost, ent.PackingCost, ent.HasExpressDelivery, ent.Stock, ent.MaxOrderCount,
|
||||||
ent.BrandId,
|
ent.BrandId,
|
||||||
ent.CategoryId);
|
ent.CategoryId,
|
||||||
|
ent.AuthorId);
|
||||||
newEnt.CreatedAt = ent.CreatedAt;
|
newEnt.CreatedAt = ent.CreatedAt;
|
||||||
newEnt.CreatedBy = ent.CreatedBy;
|
newEnt.CreatedBy = ent.CreatedBy;
|
||||||
newEnt.Id = ent.Id;
|
newEnt.Id = ent.Id;
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
namespace Netina.Repository.Handlers.Products;
|
namespace Netina.Repository.Handlers.Products;
|
||||||
|
|
||||||
public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator)
|
public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator,ICurrentUserService currentUserService)
|
||||||
: IRequestHandler<CreateProductCommand, ProductLDto>
|
: IRequestHandler<CreateProductCommand, ProductLDto>
|
||||||
{
|
{
|
||||||
public async Task<ProductLDto> Handle(CreateProductCommand request, CancellationToken cancellationToken)
|
public async Task<ProductLDto> Handle(CreateProductCommand request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (currentUserService.UserId == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
|
||||||
var ent = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck,
|
var ent = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck,
|
||||||
request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost,
|
request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost,
|
||||||
request.HasExpressDelivery,
|
request.HasExpressDelivery,
|
||||||
request.Stock,
|
request.Stock,
|
||||||
request.MaxOrderCount,
|
request.MaxOrderCount,
|
||||||
request.BrandId,request.CategoryId);
|
request.BrandId,request.CategoryId, userId);
|
||||||
|
|
||||||
foreach (var specification in request.Specifications)
|
foreach (var specification in request.Specifications)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Netina.Repository.Handlers.Products;
|
namespace Netina.Repository.Handlers.Products;
|
||||||
|
|
||||||
public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator)
|
public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator,ICurrentUserService currentUserService)
|
||||||
: IRequestHandler<UpdateProductCommand, bool>
|
: IRequestHandler<UpdateProductCommand, bool>
|
||||||
{
|
{
|
||||||
public async Task<bool> Handle(UpdateProductCommand request, CancellationToken cancellationToken)
|
public async Task<bool> Handle(UpdateProductCommand request, CancellationToken cancellationToken)
|
||||||
|
@ -9,7 +9,10 @@ public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM
|
||||||
.FirstOrDefaultAsync(e => e.Id == request.Id, cancellationToken);
|
.FirstOrDefaultAsync(e => e.Id == request.Id, cancellationToken);
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
throw new AppException("Product not found", ApiResultStatusCode.NotFound);
|
throw new AppException("Product not found", ApiResultStatusCode.NotFound);
|
||||||
|
if (currentUserService.UserId == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
|
if(!Guid.TryParse(currentUserService.UserId,out Guid userId))
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||||
var newEnt = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck,
|
var newEnt = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck,
|
||||||
request.Tags,
|
request.Tags,
|
||||||
request.Warranty,
|
request.Warranty,
|
||||||
|
@ -20,7 +23,8 @@ public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM
|
||||||
request.Stock,
|
request.Stock,
|
||||||
request.MaxOrderCount,
|
request.MaxOrderCount,
|
||||||
request.BrandId,
|
request.BrandId,
|
||||||
request.CategoryId);
|
request.CategoryId,
|
||||||
|
userId);
|
||||||
newEnt.Id = ent.Id;
|
newEnt.Id = ent.Id;
|
||||||
newEnt.CreatedAt = ent.CreatedAt;
|
newEnt.CreatedAt = ent.CreatedAt;
|
||||||
newEnt.CreatedBy = ent.CreatedBy;
|
newEnt.CreatedBy = ent.CreatedBy;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,97 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NetinaShop.Repository.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddAuthor : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Products",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("8723f1d2-e091-4812-9110-5161c9e23586"));
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Blogs",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("8723f1d2-e091-4812-9110-5161c9e23586"));
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Products_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Products",
|
||||||
|
column: "AuthorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Blogs_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Blogs",
|
||||||
|
column: "AuthorId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Blogs_Users_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Blogs",
|
||||||
|
column: "AuthorId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Products_Users_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Products",
|
||||||
|
column: "AuthorId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Blogs_Users_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Blogs");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Products_Users_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Products_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Blogs_AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Blogs");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "AuthorId",
|
||||||
|
schema: "public",
|
||||||
|
table: "Blogs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ namespace NetinaShop.Repository.Migrations
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasDefaultSchema("public")
|
.HasDefaultSchema("public")
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
.HasAnnotation("ProductVersion", "8.0.7")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch");
|
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch");
|
||||||
|
@ -208,6 +208,9 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("AuthorId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<Guid>("CategoryId")
|
b.Property<Guid>("CategoryId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
@ -263,6 +266,8 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AuthorId");
|
||||||
|
|
||||||
b.HasIndex("CategoryId");
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
b.ToTable("Blogs", "public");
|
b.ToTable("Blogs", "public");
|
||||||
|
@ -491,7 +496,7 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
b.ToTable("Discounts", "public");
|
b.ToTable("Discounts", "public");
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("Discount");
|
b.HasDiscriminator().HasValue("Discount");
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
b.UseTphMappingStrategy();
|
||||||
});
|
});
|
||||||
|
@ -791,6 +796,9 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("AuthorId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<bool>("BeDisplayed")
|
b.Property<bool>("BeDisplayed")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
@ -881,6 +889,8 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AuthorId");
|
||||||
|
|
||||||
b.HasIndex("BrandId");
|
b.HasIndex("BrandId");
|
||||||
|
|
||||||
b.HasIndex("CategoryId");
|
b.HasIndex("CategoryId");
|
||||||
|
@ -888,68 +898,6 @@ namespace NetinaShop.Repository.Migrations
|
||||||
b.ToTable("Products", "public");
|
b.ToTable("Products", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Products.Review", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("Comment")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("CreatedBy")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("IsBuyer")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("IsConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("IsRemoved")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("ModifiedBy")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("ProductId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<float>("Rate")
|
|
||||||
.HasColumnType("real");
|
|
||||||
|
|
||||||
b.Property<DateTime>("RemovedAt")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("RemovedBy")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ProductId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Reviews", "public");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
@ -1010,6 +958,68 @@ namespace NetinaShop.Repository.Migrations
|
||||||
b.ToTable("Specifications", "public");
|
b.ToTable("Specifications", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Netina.Domain.Entities.Reviews.Review", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("IsBuyer")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsConfirmed")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRemoved")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ModifiedAt")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ModifiedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProductId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<float>("Rate")
|
||||||
|
.HasColumnType("real");
|
||||||
|
|
||||||
|
b.Property<DateTime>("RemovedAt")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<string>("RemovedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("Reviews", "public");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
@ -1070,7 +1080,7 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
b.ToTable("StorageFiles", "public");
|
b.ToTable("StorageFiles", "public");
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("StorageFile");
|
b.HasDiscriminator().HasValue("StorageFile");
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
b.UseTphMappingStrategy();
|
||||||
});
|
});
|
||||||
|
@ -1697,11 +1707,18 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "Author")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AuthorId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Category")
|
b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Category")
|
||||||
.WithMany("Blogs")
|
.WithMany("Blogs")
|
||||||
.HasForeignKey("CategoryId")
|
.HasForeignKey("CategoryId")
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
b.Navigation("Author");
|
||||||
|
|
||||||
b.Navigation("Category");
|
b.Navigation("Category");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1789,6 +1806,11 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "Author")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AuthorId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand")
|
b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand")
|
||||||
.WithMany("Products")
|
.WithMany("Products")
|
||||||
.HasForeignKey("BrandId")
|
.HasForeignKey("BrandId")
|
||||||
|
@ -1799,28 +1821,13 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.HasForeignKey("CategoryId")
|
.HasForeignKey("CategoryId")
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
b.Navigation("Author");
|
||||||
|
|
||||||
b.Navigation("Brand");
|
b.Navigation("Brand");
|
||||||
|
|
||||||
b.Navigation("Category");
|
b.Navigation("Category");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Products.Review", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Netina.Domain.Entities.Products.Product", "Product")
|
|
||||||
.WithMany("Reviews")
|
|
||||||
.HasForeignKey("ProductId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.Navigation("Product");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Netina.Domain.Entities.Products.Specification", "Parent")
|
b.HasOne("Netina.Domain.Entities.Products.Specification", "Parent")
|
||||||
|
@ -1837,6 +1844,23 @@ namespace NetinaShop.Repository.Migrations
|
||||||
b.Navigation("Product");
|
b.Navigation("Product");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Netina.Domain.Entities.Reviews.Review", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Netina.Domain.Entities.Products.Product", "Product")
|
||||||
|
.WithMany("Reviews")
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User")
|
b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User")
|
||||||
|
|
Loading…
Reference in New Issue