feat : add blog controller and entities
parent
173828db0f
commit
a18976d34f
|
@ -14,14 +14,14 @@
|
|||
}
|
||||
},
|
||||
"SiteSettings": {
|
||||
"BaseUrl": "http://192.168.88.251:27137",
|
||||
"BaseUrl": "http://localhost:32776",
|
||||
"AdminPanelBaseUrl": "https://admin.vesmook.com",
|
||||
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
|
||||
"StorageSetting": {
|
||||
"AccessKey": "",
|
||||
"SecretKey": ""
|
||||
},
|
||||
"UserSetting": {
|
||||
"RootUser": {
|
||||
"Username": "09214802813",
|
||||
"Email": "avvampier@gmail.com",
|
||||
"Password": "55k6bXxIWT5M487L",
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
namespace HiVakil.Api.Controller;
|
||||
|
||||
|
||||
public class AuthController : ICarterModule
|
||||
{
|
||||
public virtual void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("Auth")
|
||||
.MapGroup($"api/auth");
|
||||
|
||||
group.MapPost("login/password", LoginWithPassword)
|
||||
.WithDisplayName("LoginWithPassword")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("login/swagger", LoginSwagger)
|
||||
.WithDisplayName("LoginSwagger")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("login/code", LoginWithVerifyCode)
|
||||
.WithDisplayName("LoginWithVerifyCode")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("verifycode", GetVerifyCodeCode)
|
||||
.WithDisplayName("GetVerifyCodeCode")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("forget/password", ForgetPassword)
|
||||
.WithDisplayName("ForgetPassword")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("signup", SignUpComplex)
|
||||
.WithDisplayName("SignUp")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
public async Task<IResult> SignUpComplex([FromBody] SignUpRequestDto request, IAccountService accountService, CancellationToken cancellationToken) =>
|
||||
TypedResults.Ok(await accountService.CompleteSignUpAsync(request, cancellationToken));
|
||||
|
||||
public async Task<IResult> LoginWithPassword([FromBody] LoginRequestDto loginRequestDto, IAccountService accountService, CancellationToken cancellationToken) =>
|
||||
TypedResults.Ok(await accountService.LoginWithPasswordAsync(loginRequestDto.UserName, loginRequestDto.Password, cancellationToken));
|
||||
|
||||
|
||||
public async Task<IResult> LoginWithVerifyCode([FromBody] LoginRequestDto loginRequestDto, IAccountService accountService, CancellationToken cancellationToken) =>
|
||||
TypedResults.Ok(await accountService.LoginWithVerifyCodeAsync(loginRequestDto.UserName, loginRequestDto.VerifyCode, cancellationToken));
|
||||
|
||||
|
||||
public async Task<IResult> GetVerifyCodeCode([FromQuery] string phoneNumber, IAccountService accountService) =>
|
||||
TypedResults.Ok(await accountService.GetVerifyCodeAsync(phoneNumber));
|
||||
|
||||
|
||||
public async Task<IResult> ForgetPassword([FromQuery] string phoneNumber, IAccountService accountService) =>
|
||||
TypedResults.Ok(await accountService.ForgetPasswordAsync(phoneNumber));
|
||||
|
||||
|
||||
public async Task<IResult> LoginSwagger(HttpContext ctx, IAccountService accountService, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var username = ctx.Request.Form["username"];
|
||||
var password = ctx.Request.Form["password"];
|
||||
return TypedResults.Json(await accountService.LoginWithPasswordAsync(username, password, cancellationToken));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
namespace HiVakil.Api.Controller;
|
||||
|
||||
public class BlogCategoryController : ICarterModule
|
||||
{
|
||||
public void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("BlogCategory").MapGroup("api/blog/category");
|
||||
|
||||
group.MapGet("", GetBlogCategoriesAsync)
|
||||
.WithDisplayName("GetBlogCategories")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetBlogCategoryAsync)
|
||||
.WithDisplayName("GetBlogCategory")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", CreateBlogCategoryAsync)
|
||||
.WithDisplayName("CreateBlogCategory")
|
||||
.RequireAuthorization(builder=>builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission,ApplicationPermission.ManageBlogCategories))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", UpdateBlogCategoryAsync)
|
||||
.WithDisplayName("UpdateBlogCategory")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogCategories))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", DeleteBlogCategoryAsync)
|
||||
.WithDisplayName("DeleteBlogCategory")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogCategories))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
}
|
||||
|
||||
private async Task<IResult> GetBlogCategoriesAsync([FromQuery] int page, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetBlogCategoriesQuery(Page: page), cancellationToken));
|
||||
|
||||
private async Task<IResult> GetBlogCategoryAsync(Guid id, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetBlogCategoryQuery(Id: id), cancellationToken));
|
||||
|
||||
private async Task<IResult> CreateBlogCategoryAsync(CreateBlogCategoryCommand request, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(request, cancellationToken));
|
||||
|
||||
private async Task<IResult> UpdateBlogCategoryAsync(UpdateBlogCategoryCommand request, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(request, cancellationToken));
|
||||
|
||||
private async Task<IResult> DeleteBlogCategoryAsync(Guid id, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new DeleteBlogCategoryCommand(Id: id), cancellationToken));
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
namespace HiVakil.Api.Controller;
|
||||
|
||||
public class BlogController : ICarterModule
|
||||
{
|
||||
public void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("Blog")
|
||||
.MapGroup("api/blog");
|
||||
|
||||
group.MapGet("", GetBlogsAsync)
|
||||
.WithDisplayName("GetBlogs")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetBlogAsync)
|
||||
.WithDisplayName("GetBlog")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", CreateBlogAsync)
|
||||
.WithDisplayName("CreateBlog")
|
||||
.RequireAuthorization(builder=>builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission,ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", UpdateBlogAsync)
|
||||
.WithDisplayName("UpdateBlog")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", DeleteBlogAsync)
|
||||
.WithDisplayName("DeleteBlog")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
private async Task<IResult> GetBlogsAsync([FromQuery] int page, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetBlogsQuery(Page : page),cancellationToken));
|
||||
|
||||
private async Task<IResult> GetBlogAsync(Guid id, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetBlogQuery(id),cancellationToken));
|
||||
|
||||
private async Task<IResult> CreateBlogAsync(CreateBlogCommand request, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(request, cancellationToken));
|
||||
|
||||
private async Task<IResult> UpdateBlogAsync(UpdateBlogCommand request, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(request, cancellationToken));
|
||||
|
||||
private async Task<IResult> DeleteBlogAsync(Guid id, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new DeleteBlogCommand(id), cancellationToken));
|
||||
}
|
|
@ -72,9 +72,14 @@
|
|||
<Using Include="HiVakil.Common.Models.Exception" />
|
||||
<Using Include="HiVakil.Common.Models.Mapper" />
|
||||
<Using Include="HiVakil.Core" />
|
||||
<Using Include="HiVakil.Core.CoreServices.Abstracts" />
|
||||
<Using Include="HiVakil.Core.Models.Api" />
|
||||
<Using Include="HiVakil.Domain" />
|
||||
<Using Include="HiVakil.Domain.CommandQueries.Commands" />
|
||||
<Using Include="HiVakil.Domain.CommandQueries.Queries" />
|
||||
<Using Include="HiVakil.Domain.Dtos.RequestDto" />
|
||||
<Using Include="HiVakil.Domain.Entities.Users" />
|
||||
<Using Include="HiVakil.Domain.Models.Claims" />
|
||||
<Using Include="HiVakil.Domain.Models.Settings" />
|
||||
<Using Include="HiVakil.Infrastructure" />
|
||||
<Using Include="HiVakil.Infrastructure.Models" />
|
||||
|
|
|
@ -34,7 +34,7 @@ builder.Services.AddCustomAuthorization();
|
|||
builder.Services.AddJwtCustomAuthentication(siteSetting.JwtSettings);
|
||||
builder.Services.AddMvcCore().AddRazorPages().AddRazorViewEngine().AddViews();
|
||||
builder.Services.AddCustomIdentity();
|
||||
//builder.Services.AddCustomDbContext(configuration);
|
||||
builder.Services.AddCustomDbContext(configuration);
|
||||
builder.Services.AddMarten(configuration, builder.Environment);
|
||||
builder.Services.AddCarter();
|
||||
|
||||
|
@ -106,7 +106,7 @@ app.UseExceptionHandlerMiddleware();
|
|||
|
||||
app.MapCarter();
|
||||
app.UseStaticFiles();
|
||||
//await app.InitialDb();
|
||||
await app.InitialDb();
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
|
@ -23,10 +23,10 @@
|
|||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||
"ASPNETCORE_URLS": "http://+:80"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"DockerfileRunArguments": " --network=mother -p 27137:80"
|
||||
"DockerfileRunArguments": " --network=mother -p 32776:80"
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
|
|
|
@ -183,7 +183,8 @@ public static class ServiceExtensions
|
|||
}).AddEntityFrameworkStores<ApplicationContext>()
|
||||
.AddDefaultTokenProviders()
|
||||
.AddErrorDescriber<PersianIdentityErrorDescriber>();
|
||||
;
|
||||
|
||||
serviceCollection.AddIdentityCore<Lawyer>().AddEntityFrameworkStores<ApplicationContext>();
|
||||
}
|
||||
|
||||
public static void AddCustomApiVersioning(this IServiceCollection serviceCollection)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
namespace HiVakil.Domain.CommandQueries.Commands;
|
||||
|
||||
public record CreateBlogCategoryCommand(string Name ,string Description) : IRequest<bool>;
|
||||
public record UpdateBlogCategoryCommand(Guid Id,string Name, string Description) : IRequest<bool>;
|
||||
public record DeleteBlogCategoryCommand(Guid Id) : IRequest<bool>;
|
|
@ -0,0 +1,7 @@
|
|||
using System.Net.Http;
|
||||
|
||||
namespace HiVakil.Domain.CommandQueries.Commands;
|
||||
|
||||
public record CreateBlogCommand(string Title, string Content, string Tags, int ReadingTime, string Summery, bool IsSuggested, List<StorageFileSDto> Files, Guid CategoryId) : IRequest<bool>;
|
||||
public record UpdateBlogCommand(Guid Id, string Title, string Content, string Tags, int ReadingTime, string Summery, bool IsSuggested, List<StorageFileSDto> Files, Guid CategoryId) : IRequest<bool>;
|
||||
public record DeleteBlogCommand(Guid Id) : IRequest<bool>;
|
|
@ -0,0 +1,4 @@
|
|||
namespace HiVakil.Domain.CommandQueries.Queries;
|
||||
|
||||
public record GetBlogCategoriesQuery(int Page) : IRequest<List<BlogCategorySDto>>;
|
||||
public record GetBlogCategoryQuery(Guid Id) : IRequest<BlogCategoryLDto>;
|
|
@ -0,0 +1,4 @@
|
|||
namespace HiVakil.Domain.CommandQueries.Queries;
|
||||
|
||||
public record GetBlogsQuery(int Page = 0) : IRequest<GetBlogsResponseDto>;
|
||||
public record GetBlogQuery(Guid Id) : IRequest<BlogLDto>;
|
|
@ -0,0 +1,11 @@
|
|||
using HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
namespace HiVakil.Domain.Dtos.LargDto;
|
||||
|
||||
public class BlogCategoryLDto : BaseDto<BlogCategoryLDto , BlogCategory>
|
||||
{
|
||||
|
||||
public string Name { get; internal set; } = string.Empty;
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
public List<BlogSDto> Blogs { get; internal set; } = new();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
namespace HiVakil.Domain.Dtos.LargDto;
|
||||
|
||||
public class BlogLDto : BaseDto<BlogLDto , Blog>
|
||||
{
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string Tags { get; set; } = string.Empty;
|
||||
public int ReadingTime { get; set; }
|
||||
public string Summery { get; set; } = string.Empty;
|
||||
public bool IsSuggested { get; set; }
|
||||
public Guid CategoryId { get; set; }
|
||||
public List<StorageFileSDto> Files { get; set; } = new();
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace HiVakil.Domain.Dtos.RequestDto;
|
||||
|
||||
public class LoginRequestDto
|
||||
{
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string VerifyCode { get; set; } = string.Empty;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace HiVakil.Domain.Dtos.ResponseDto;
|
||||
|
||||
public class GetBlogsResponseDto
|
||||
{
|
||||
public List<BlogSDto> Blogs { get; set; } = new();
|
||||
public PagerResponseDto Pager { get; set; } = new PagerResponseDto();
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace HiVakil.Domain.Dtos.ResponseDto;
|
||||
|
||||
public class PagerResponseDto
|
||||
{
|
||||
public int CurrentPage { get; set; }
|
||||
public int TotalItems { get; set; }
|
||||
public int TotalPage { get; set; }
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
namespace HiVakil.Domain.Dtos.SmallDtos;
|
||||
|
||||
public class BlogCategorySDto : BaseDto<BlogCategorySDto , BlogCategory>
|
||||
{
|
||||
public string Name { get; internal set; } = string.Empty;
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
namespace HiVakil.Domain.Dtos.SmallDtos;
|
||||
|
||||
public class BlogSDto : BaseDto<BlogSDto,Blog>
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string Tags { get; set; } = string.Empty;
|
||||
public int ReadingTime { get; set; }
|
||||
public string Summery { get; set; } = string.Empty;
|
||||
public bool IsSuggested { get; set; }
|
||||
public Guid CategoryId { get; set; }
|
||||
public string CategoryName { get; set; } = string.Empty;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
namespace HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
public partial class Blog
|
||||
{
|
||||
public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
|
||||
{
|
||||
return new Blog(title, content, tags, readingTime, summery, isSuggested, categoryId);
|
||||
}
|
||||
|
||||
public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)
|
||||
{
|
||||
var file = BlogStorageFile.Create(name, fileLocation, fileName, isHeader, isPrimary, fileType, this.Id);
|
||||
Files.Add(file);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BlogStorageFile
|
||||
{
|
||||
public static BlogStorageFile Create(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType, Guid blogId)
|
||||
{
|
||||
return new BlogStorageFile(name, fileLocation, fileName, isHeader, isPrimary, fileType, blogId);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BlogCategory
|
||||
{
|
||||
public static BlogCategory Create(string name,string description)
|
||||
{
|
||||
if (name.IsNullOrEmpty())
|
||||
throw new AppException("Category Name cant be null");
|
||||
|
||||
return new BlogCategory(name, description);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
namespace HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
public partial class Blog : ApiEntity
|
||||
{
|
||||
public Blog()
|
||||
{
|
||||
|
||||
}
|
||||
public Blog(string title,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId)
|
||||
{
|
||||
Title = title;
|
||||
Content = content;
|
||||
Tags = tags;
|
||||
ReadingTime = readingTime;
|
||||
Summery = summery;
|
||||
IsSuggested = isSuggested;
|
||||
CategoryId = categoryId;
|
||||
}
|
||||
public string Title { get; internal set; } = string.Empty;
|
||||
public string Content { get; internal set; } = string.Empty;
|
||||
public string Tags { get; internal set; } = string.Empty;
|
||||
public int ReadingTime { get; internal set; }
|
||||
public string Summery { get; internal set; } = string.Empty;
|
||||
public bool IsSuggested { get; internal set; }
|
||||
public Guid CategoryId { get; internal set; }
|
||||
public BlogCategory? Category { get; internal set; }
|
||||
public List<BlogStorageFile> Files { get; internal set; } = new();
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
namespace HiVakil.Domain.Entities.Blogs;
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class BlogCategory : ApiEntity
|
||||
{
|
||||
public BlogCategory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BlogCategory(string name, string description)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
}
|
||||
public string Name { get; internal set; } = string.Empty;
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
public List<Blog> Blogs { get; internal set; } = new();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
namespace HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
public partial class BlogStorageFile : StorageFile
|
||||
{
|
||||
public BlogStorageFile()
|
||||
{
|
||||
|
||||
}
|
||||
public BlogStorageFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType, Guid blogId) :
|
||||
base(name, fileLocation, fileName, isHeader, isPrimary, fileType)
|
||||
{
|
||||
BlogId = blogId;
|
||||
}
|
||||
public Guid BlogId { get; internal set; }
|
||||
public Blog? Blog { get; internal set; }
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace HiVakil.Domain.Entities.LawyerCategories;
|
||||
|
||||
public class LawyerCategory : ApiEntity
|
||||
{
|
||||
public string Title { get; internal set; } = string.Empty;
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
|
||||
public List<LawyerCategoryUser> Users { get; internal set; } = new();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace HiVakil.Domain.Entities.LawyerCategories;
|
||||
|
||||
public class LawyerCategoryUser : ApiEntity
|
||||
{
|
||||
public Guid CategoryId { get; internal set; }
|
||||
public LawyerCategory? Category { get; internal set; }
|
||||
|
||||
public Guid UserId { get; internal set; }
|
||||
public ApplicationUser? User { get; internal set; }
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace HiVakil.Domain.Entities.LegalForms;
|
||||
|
||||
public class LegalForm : ApiEntity
|
||||
{
|
||||
public string Title { get; internal set; } = string.Empty;
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
public LegalFormStatus Status { get; set; }
|
||||
public LegalFormType Type { get; internal set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace HiVakil.Domain.Entities.LegalRequests;
|
||||
|
||||
public class LegalRequest : ApiEntity
|
||||
{
|
||||
public string Title { get; internal set; } = string.Empty;
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
public LegalRequestStatus Status { get; internal set; }
|
||||
public LegalRequestType Type { get; internal set; }
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
namespace HiVakil.Domain.Entities.Payments;
|
||||
|
||||
public class Payment
|
||||
{
|
||||
|
||||
public string FactorNumber { get; internal set; } = string.Empty;
|
||||
public double Amount { get; internal set; }
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
public string TransactionCode { get; internal set; } = string.Empty;
|
||||
public string CardPan { get; internal set; } = string.Empty;
|
||||
public string Authority { get; internal set; } = string.Empty;
|
||||
public PaymentType Type { get; internal set; }
|
||||
public PaymentStatus Status { get; internal set; }
|
||||
|
||||
public Guid PayerId { get; internal set; }
|
||||
public ApplicationUser? Payer { get; internal set; }
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace HiVakil.Domain.Entities.Reviews;
|
||||
|
||||
public class LawyerReview : Review
|
||||
{
|
||||
public Guid ApplicationUserId { get; internal set; }
|
||||
public ApplicationUser? User { get; internal set; }
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace HiVakil.Domain.Entities.Reviews;
|
||||
|
||||
public class Review : ApiEntity
|
||||
{
|
||||
public string Comment { get; internal set; } = string.Empty;
|
||||
public double Rate { get; internal set; }
|
||||
public ReviewType Type { get; internal set; }
|
||||
}
|
|
@ -12,6 +12,9 @@ public class ApplicationUser : IdentityUser<Guid>
|
|||
public string LastName { get; set; } = string.Empty;
|
||||
public string NationalId { get; set; } = string.Empty;
|
||||
|
||||
public string City { get; set; } = string.Empty;
|
||||
public int CityId { get; set; }
|
||||
|
||||
public DateTime BirthDate { get; set; }
|
||||
public Gender Gender { get; set; }
|
||||
public SignUpStatus SignUpStatus { get; set; }
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Entities.Users;
|
||||
|
||||
public class Lawyer : ApplicationUser
|
||||
{
|
||||
public string LawyerCode { get; set; } = string.Empty;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace HiVakil.Domain.Entities.Users;
|
||||
|
||||
public class UserCallRequest : ApiEntity
|
||||
{
|
||||
public string FullName { get; internal set; } = string.Empty;
|
||||
public string PhoneNumber { get; internal set; } = string.Empty;
|
||||
public string Email { get; internal set; } = string.Empty;
|
||||
public string Message { get; internal set; } = string.Empty;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum LegalFormStatus
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum LegalFormType
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum LegalRequestStatus
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum LegalRequestType
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum PaymentStatus
|
||||
{
|
||||
[Display(Name = "در انتظار پرداخت درگاه")]
|
||||
InPaymentGateway = 0,
|
||||
[Display(Name = "در انتظار پرداخت")]
|
||||
NotPaidYet = 1,
|
||||
[Display(Name = "پرداخت شده")]
|
||||
Paid = 200,
|
||||
[Display(Name = "کنسل شده")]
|
||||
Cancel = 500
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum PaymentType
|
||||
{
|
||||
[Display(Name = "نقدی")]
|
||||
Cash,
|
||||
[Display(Name = "کارت به کارت")]
|
||||
CardTransfer,
|
||||
[Display(Name = "آنلاین")]
|
||||
Online,
|
||||
[Display(Name = "در محل")]
|
||||
PayOnDoor
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace HiVakil.Domain.Enums;
|
||||
|
||||
public enum ReviewType
|
||||
{
|
||||
Lawyer,
|
||||
Request
|
||||
}
|
|
@ -49,8 +49,12 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Using Include="HiVakil.Common.Extensions" />
|
||||
<Using Include="HiVakil.Common.Models.Api" />
|
||||
<Using Include="HiVakil.Common.Models.Entity" />
|
||||
<Using Include="HiVakil.Common.Models.Exception" />
|
||||
<Using Include="HiVakil.Common.Models.Mapper" />
|
||||
<Using Include="HiVakil.Domain.Dtos.LargDto" />
|
||||
<Using Include="HiVakil.Domain.Dtos.ResponseDto" />
|
||||
<Using Include="HiVakil.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="HiVakil.Domain.Entities.StorageFiles" />
|
||||
<Using Include="HiVakil.Domain.Entities.Users" />
|
||||
|
@ -69,8 +73,12 @@
|
|||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Dtos\ResponseDto\" />
|
||||
<Folder Include="Dtos\LargDto\" />
|
||||
<Folder Include="Dtos\SmallDtos\" />
|
||||
<Folder Include="Entities\LegalForms\" />
|
||||
<Folder Include="Entities\LawyerCategories\" />
|
||||
<Folder Include="Entities\Payments\" />
|
||||
<Folder Include="Entities\Reviews\" />
|
||||
<Folder Include="Entities\StorageFiles\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -0,0 +1,294 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using HiVakil.Domain.Dtos.LargDto;
|
||||
using HiVakil.Domain.Dtos.SmallDtos;
|
||||
using HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
namespace HiVakil.Domain.Mappers
|
||||
{
|
||||
public static partial class BlogCategoryMapper
|
||||
{
|
||||
public static BlogCategory AdaptToBlogCategory(this BlogCategoryLDto p1)
|
||||
{
|
||||
return p1 == null ? null : new BlogCategory()
|
||||
{
|
||||
Name = p1.Name,
|
||||
Description = p1.Description,
|
||||
Blogs = funcMain1(p1.Blogs),
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategory AdaptTo(this BlogCategoryLDto p3, BlogCategory p4)
|
||||
{
|
||||
if (p3 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogCategory result = p4 ?? new BlogCategory();
|
||||
|
||||
result.Name = p3.Name;
|
||||
result.Description = p3.Description;
|
||||
result.Blogs = funcMain2(p3.Blogs, result.Blogs);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<BlogCategoryLDto, BlogCategory>> ProjectToBlogCategory => p7 => new BlogCategory()
|
||||
{
|
||||
Name = p7.Name,
|
||||
Description = p7.Description,
|
||||
Blogs = p7.Blogs.Select<BlogSDto, Blog>(p8 => new Blog()
|
||||
{
|
||||
Title = p8.Title,
|
||||
Content = p8.Content,
|
||||
Tags = p8.Tags,
|
||||
ReadingTime = p8.ReadingTime,
|
||||
Summery = p8.Summery,
|
||||
IsSuggested = p8.IsSuggested,
|
||||
CategoryId = p8.CategoryId,
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
}).ToList<Blog>(),
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static BlogCategoryLDto AdaptToLDto(this BlogCategory p9)
|
||||
{
|
||||
return p9 == null ? null : new BlogCategoryLDto()
|
||||
{
|
||||
Name = p9.Name,
|
||||
Description = p9.Description,
|
||||
Blogs = funcMain3(p9.Blogs),
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategoryLDto AdaptTo(this BlogCategory p11, BlogCategoryLDto p12)
|
||||
{
|
||||
if (p11 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogCategoryLDto result = p12 ?? new BlogCategoryLDto();
|
||||
|
||||
result.Name = p11.Name;
|
||||
result.Description = p11.Description;
|
||||
result.Blogs = funcMain4(p11.Blogs, result.Blogs);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<BlogCategory, BlogCategoryLDto>> ProjectToLDto => p15 => new BlogCategoryLDto()
|
||||
{
|
||||
Name = p15.Name,
|
||||
Description = p15.Description,
|
||||
Blogs = p15.Blogs.Select<Blog, BlogSDto>(p16 => new BlogSDto()
|
||||
{
|
||||
Title = p16.Title,
|
||||
Content = p16.Content,
|
||||
Tags = p16.Tags,
|
||||
ReadingTime = p16.ReadingTime,
|
||||
Summery = p16.Summery,
|
||||
IsSuggested = p16.IsSuggested,
|
||||
CategoryId = p16.CategoryId,
|
||||
CategoryName = p16.Category.Name,
|
||||
Id = p16.Id,
|
||||
CreatedAt = p16.CreatedAt
|
||||
}).ToList<BlogSDto>(),
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
public static BlogCategory AdaptToBlogCategory(this BlogCategorySDto p17)
|
||||
{
|
||||
return p17 == null ? null : new BlogCategory()
|
||||
{
|
||||
Name = p17.Name,
|
||||
Description = p17.Description,
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategory AdaptTo(this BlogCategorySDto p18, BlogCategory p19)
|
||||
{
|
||||
if (p18 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogCategory result = p19 ?? new BlogCategory();
|
||||
|
||||
result.Name = p18.Name;
|
||||
result.Description = p18.Description;
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static BlogCategorySDto AdaptToSDto(this BlogCategory p20)
|
||||
{
|
||||
return p20 == null ? null : new BlogCategorySDto()
|
||||
{
|
||||
Name = p20.Name,
|
||||
Description = p20.Description,
|
||||
Id = p20.Id,
|
||||
CreatedAt = p20.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategorySDto AdaptTo(this BlogCategory p21, BlogCategorySDto p22)
|
||||
{
|
||||
if (p21 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogCategorySDto result = p22 ?? new BlogCategorySDto();
|
||||
|
||||
result.Name = p21.Name;
|
||||
result.Description = p21.Description;
|
||||
result.Id = p21.Id;
|
||||
result.CreatedAt = p21.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<BlogCategory, BlogCategorySDto>> ProjectToSDto => p23 => new BlogCategorySDto()
|
||||
{
|
||||
Name = p23.Name,
|
||||
Description = p23.Description,
|
||||
Id = p23.Id,
|
||||
CreatedAt = p23.CreatedAt
|
||||
};
|
||||
|
||||
private static List<Blog> funcMain1(List<BlogSDto> p2)
|
||||
{
|
||||
if (p2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<Blog> result = new List<Blog>(p2.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p2.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogSDto item = p2[i];
|
||||
result.Add(item == null ? null : new Blog()
|
||||
{
|
||||
Title = item.Title,
|
||||
Content = item.Content,
|
||||
Tags = item.Tags,
|
||||
ReadingTime = item.ReadingTime,
|
||||
Summery = item.Summery,
|
||||
IsSuggested = item.IsSuggested,
|
||||
CategoryId = item.CategoryId,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<Blog> funcMain2(List<BlogSDto> p5, List<Blog> p6)
|
||||
{
|
||||
if (p5 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<Blog> result = new List<Blog>(p5.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p5.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogSDto item = p5[i];
|
||||
result.Add(item == null ? null : new Blog()
|
||||
{
|
||||
Title = item.Title,
|
||||
Content = item.Content,
|
||||
Tags = item.Tags,
|
||||
ReadingTime = item.ReadingTime,
|
||||
Summery = item.Summery,
|
||||
IsSuggested = item.IsSuggested,
|
||||
CategoryId = item.CategoryId,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<BlogSDto> funcMain3(List<Blog> p10)
|
||||
{
|
||||
if (p10 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogSDto> result = new List<BlogSDto>(p10.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
Blog item = p10[i];
|
||||
result.Add(item == null ? null : new BlogSDto()
|
||||
{
|
||||
Title = item.Title,
|
||||
Content = item.Content,
|
||||
Tags = item.Tags,
|
||||
ReadingTime = item.ReadingTime,
|
||||
Summery = item.Summery,
|
||||
IsSuggested = item.IsSuggested,
|
||||
CategoryId = item.CategoryId,
|
||||
CategoryName = item.Category == null ? null : item.Category.Name,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<BlogSDto> funcMain4(List<Blog> p13, List<BlogSDto> p14)
|
||||
{
|
||||
if (p13 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogSDto> result = new List<BlogSDto>(p13.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p13.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
Blog item = p13[i];
|
||||
result.Add(item == null ? null : new BlogSDto()
|
||||
{
|
||||
Title = item.Title,
|
||||
Content = item.Content,
|
||||
Tags = item.Tags,
|
||||
ReadingTime = item.ReadingTime,
|
||||
Summery = item.Summery,
|
||||
IsSuggested = item.IsSuggested,
|
||||
CategoryId = item.CategoryId,
|
||||
CategoryName = item.Category == null ? null : item.Category.Name,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,340 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using HiVakil.Domain.Dtos.LargDto;
|
||||
using HiVakil.Domain.Dtos.SmallDtos;
|
||||
using HiVakil.Domain.Entities.Blogs;
|
||||
|
||||
namespace HiVakil.Domain.Mappers
|
||||
{
|
||||
public static partial class BlogMapper
|
||||
{
|
||||
public static Blog AdaptToBlog(this BlogLDto p1)
|
||||
{
|
||||
return p1 == null ? null : new Blog()
|
||||
{
|
||||
Title = p1.Title,
|
||||
Content = p1.Content,
|
||||
Tags = p1.Tags,
|
||||
ReadingTime = p1.ReadingTime,
|
||||
Summery = p1.Summery,
|
||||
IsSuggested = p1.IsSuggested,
|
||||
CategoryId = p1.CategoryId,
|
||||
Files = funcMain1(p1.Files),
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Blog AdaptTo(this BlogLDto p3, Blog p4)
|
||||
{
|
||||
if (p3 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Blog result = p4 ?? new Blog();
|
||||
|
||||
result.Title = p3.Title;
|
||||
result.Content = p3.Content;
|
||||
result.Tags = p3.Tags;
|
||||
result.ReadingTime = p3.ReadingTime;
|
||||
result.Summery = p3.Summery;
|
||||
result.IsSuggested = p3.IsSuggested;
|
||||
result.CategoryId = p3.CategoryId;
|
||||
result.Files = funcMain2(p3.Files, result.Files);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<BlogLDto, Blog>> ProjectToBlog => p7 => new Blog()
|
||||
{
|
||||
Title = p7.Title,
|
||||
Content = p7.Content,
|
||||
Tags = p7.Tags,
|
||||
ReadingTime = p7.ReadingTime,
|
||||
Summery = p7.Summery,
|
||||
IsSuggested = p7.IsSuggested,
|
||||
CategoryId = p7.CategoryId,
|
||||
Files = p7.Files.Select<StorageFileSDto, BlogStorageFile>(p8 => new BlogStorageFile()
|
||||
{
|
||||
Name = p8.Name,
|
||||
FileLocation = p8.FileLocation,
|
||||
FileName = p8.FileName,
|
||||
IsHeader = p8.IsHeader,
|
||||
IsPrimary = p8.IsPrimary,
|
||||
FileType = p8.FileType,
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
}).ToList<BlogStorageFile>(),
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static BlogLDto AdaptToLDto(this Blog p9)
|
||||
{
|
||||
return p9 == null ? null : new BlogLDto()
|
||||
{
|
||||
Title = p9.Title,
|
||||
Content = p9.Content,
|
||||
Tags = p9.Tags,
|
||||
ReadingTime = p9.ReadingTime,
|
||||
Summery = p9.Summery,
|
||||
IsSuggested = p9.IsSuggested,
|
||||
CategoryId = p9.CategoryId,
|
||||
Files = funcMain3(p9.Files),
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogLDto AdaptTo(this Blog p11, BlogLDto p12)
|
||||
{
|
||||
if (p11 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogLDto result = p12 ?? new BlogLDto();
|
||||
|
||||
result.Title = p11.Title;
|
||||
result.Content = p11.Content;
|
||||
result.Tags = p11.Tags;
|
||||
result.ReadingTime = p11.ReadingTime;
|
||||
result.Summery = p11.Summery;
|
||||
result.IsSuggested = p11.IsSuggested;
|
||||
result.CategoryId = p11.CategoryId;
|
||||
result.Files = funcMain4(p11.Files, result.Files);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Blog, BlogLDto>> ProjectToLDto => p15 => new BlogLDto()
|
||||
{
|
||||
Title = p15.Title,
|
||||
Content = p15.Content,
|
||||
Tags = p15.Tags,
|
||||
ReadingTime = p15.ReadingTime,
|
||||
Summery = p15.Summery,
|
||||
IsSuggested = p15.IsSuggested,
|
||||
CategoryId = p15.CategoryId,
|
||||
Files = p15.Files.Select<BlogStorageFile, StorageFileSDto>(p16 => new StorageFileSDto()
|
||||
{
|
||||
Name = p16.Name,
|
||||
FileLocation = p16.FileLocation,
|
||||
FileName = p16.FileName,
|
||||
IsHeader = p16.IsHeader,
|
||||
IsPrimary = p16.IsPrimary,
|
||||
FileType = p16.FileType,
|
||||
Id = p16.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
public static Blog AdaptToBlog(this BlogSDto p17)
|
||||
{
|
||||
return p17 == null ? null : new Blog()
|
||||
{
|
||||
Title = p17.Title,
|
||||
Content = p17.Content,
|
||||
Tags = p17.Tags,
|
||||
ReadingTime = p17.ReadingTime,
|
||||
Summery = p17.Summery,
|
||||
IsSuggested = p17.IsSuggested,
|
||||
CategoryId = p17.CategoryId,
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Blog AdaptTo(this BlogSDto p18, Blog p19)
|
||||
{
|
||||
if (p18 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Blog result = p19 ?? new Blog();
|
||||
|
||||
result.Title = p18.Title;
|
||||
result.Content = p18.Content;
|
||||
result.Tags = p18.Tags;
|
||||
result.ReadingTime = p18.ReadingTime;
|
||||
result.Summery = p18.Summery;
|
||||
result.IsSuggested = p18.IsSuggested;
|
||||
result.CategoryId = p18.CategoryId;
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static BlogSDto AdaptToSDto(this Blog p20)
|
||||
{
|
||||
return p20 == null ? null : new BlogSDto()
|
||||
{
|
||||
Title = p20.Title,
|
||||
Content = p20.Content,
|
||||
Tags = p20.Tags,
|
||||
ReadingTime = p20.ReadingTime,
|
||||
Summery = p20.Summery,
|
||||
IsSuggested = p20.IsSuggested,
|
||||
CategoryId = p20.CategoryId,
|
||||
CategoryName = p20.Category == null ? null : p20.Category.Name,
|
||||
Id = p20.Id,
|
||||
CreatedAt = p20.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogSDto AdaptTo(this Blog p21, BlogSDto p22)
|
||||
{
|
||||
if (p21 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogSDto result = p22 ?? new BlogSDto();
|
||||
|
||||
result.Title = p21.Title;
|
||||
result.Content = p21.Content;
|
||||
result.Tags = p21.Tags;
|
||||
result.ReadingTime = p21.ReadingTime;
|
||||
result.Summery = p21.Summery;
|
||||
result.IsSuggested = p21.IsSuggested;
|
||||
result.CategoryId = p21.CategoryId;
|
||||
result.CategoryName = p21.Category == null ? null : p21.Category.Name;
|
||||
result.Id = p21.Id;
|
||||
result.CreatedAt = p21.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Blog, BlogSDto>> ProjectToSDto => p23 => new BlogSDto()
|
||||
{
|
||||
Title = p23.Title,
|
||||
Content = p23.Content,
|
||||
Tags = p23.Tags,
|
||||
ReadingTime = p23.ReadingTime,
|
||||
Summery = p23.Summery,
|
||||
IsSuggested = p23.IsSuggested,
|
||||
CategoryId = p23.CategoryId,
|
||||
CategoryName = p23.Category.Name,
|
||||
Id = p23.Id,
|
||||
CreatedAt = p23.CreatedAt
|
||||
};
|
||||
|
||||
private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||
{
|
||||
if (p2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogStorageFile> result = new List<BlogStorageFile>(p2.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p2.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
StorageFileSDto item = p2[i];
|
||||
result.Add(item == null ? null : new BlogStorageFile()
|
||||
{
|
||||
Name = item.Name,
|
||||
FileLocation = item.FileLocation,
|
||||
FileName = item.FileName,
|
||||
IsHeader = item.IsHeader,
|
||||
IsPrimary = item.IsPrimary,
|
||||
FileType = item.FileType,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<BlogStorageFile> funcMain2(List<StorageFileSDto> p5, List<BlogStorageFile> p6)
|
||||
{
|
||||
if (p5 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogStorageFile> result = new List<BlogStorageFile>(p5.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p5.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
StorageFileSDto item = p5[i];
|
||||
result.Add(item == null ? null : new BlogStorageFile()
|
||||
{
|
||||
Name = item.Name,
|
||||
FileLocation = item.FileLocation,
|
||||
FileName = item.FileName,
|
||||
IsHeader = item.IsHeader,
|
||||
IsPrimary = item.IsPrimary,
|
||||
FileType = item.FileType,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain3(List<BlogStorageFile> p10)
|
||||
{
|
||||
if (p10 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p10.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogStorageFile item = p10[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> funcMain4(List<BlogStorageFile> p13, List<StorageFileSDto> p14)
|
||||
{
|
||||
if (p13 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p13.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p13.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogStorageFile item = p13[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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Mappers
|
||||
{
|
||||
public static partial class BlogStorageFileMapper
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace HiVakil.Domain.Mappers
|
||||
{
|
||||
public static partial class LawyerMapper
|
||||
{
|
||||
}
|
||||
}
|
|
@ -15,239 +15,55 @@ public static class ApplicationClaims
|
|||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewBlogs,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageBrands { get; } = new ClaimDto
|
||||
public static ClaimDto ViewBlogCategories { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت برند ها",
|
||||
Title = "مشاهده دسته بندی بلاگ ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageBrands,
|
||||
Value = ApplicationPermission.ViewBlogCategories,
|
||||
};
|
||||
public static ClaimDto ViewBrands { get; } = new ClaimDto
|
||||
public static ClaimDto ManageBlogCategories { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده برند ها",
|
||||
Title = "مدیریت دسته بندی بلاگ ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewBrands,
|
||||
Value = ApplicationPermission.ManageBlogCategories,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageCategories { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت دسته بندی ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageCategories,
|
||||
};
|
||||
public static ClaimDto ViewCategories { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده دسته بندی ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewCategories,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageDiscounts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت تخفیف ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageDiscounts,
|
||||
};
|
||||
public static ClaimDto ViewDiscounts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده تخفیف ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewDiscounts,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageOrders { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت فروش ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageOrders,
|
||||
};
|
||||
public static ClaimDto ViewAllOrders { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده فروش ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewAllOrders,
|
||||
};
|
||||
public static ClaimDto ViewMineOrders { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده فروش های خود",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewMineOrders,
|
||||
};
|
||||
public static ClaimDto CreateOrder { get; } = new ClaimDto
|
||||
{
|
||||
Title = "ثبت سفارش",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.CreateOrder,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageProducts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت محصولات",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageProducts,
|
||||
};
|
||||
public static ClaimDto ViewProducts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده محصولات",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewProducts,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageReview { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت کامنت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageReview,
|
||||
};
|
||||
public static ClaimDto ViewAllReviews { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده کامنت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewAllReviews,
|
||||
};
|
||||
public static ClaimDto ViewMineReviews { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده کامنت های خود",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewMineReviews,
|
||||
};
|
||||
public static ClaimDto AddReview { get; } = new ClaimDto
|
||||
{
|
||||
Title = "ثبت کامنت جدید",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.AddReview,
|
||||
};
|
||||
public static ClaimDto ConfirmReview { get; } = new ClaimDto
|
||||
{
|
||||
Title = "تائید کامنت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ConfirmReview,
|
||||
};
|
||||
|
||||
public static ClaimDto ViewWarehouses { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده انبار ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewWarehouses,
|
||||
};
|
||||
public static ClaimDto ManageWarehouses { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت انبار ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageWarehouses,
|
||||
};
|
||||
|
||||
public static ClaimDto ViewShipping { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده روش های ارسال",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewShipping,
|
||||
};
|
||||
public static ClaimDto ManageShipping { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت روش های ارسال",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageShipping,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageUsers { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت کاربران",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageUsers,
|
||||
};
|
||||
public static ClaimDto ViewUsers { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده کاربران",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewUsers,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageFiles { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت فایل ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageFiles,
|
||||
};
|
||||
public static ClaimDto ViewFiles { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده فایل ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewFiles,
|
||||
};
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public static List<ClaimDto> AllClaimDtos = new List<ClaimDto>
|
||||
{
|
||||
ManageBlogs,
|
||||
ViewBlogs,
|
||||
ManageBrands,
|
||||
ViewBrands,
|
||||
ManageCategories,
|
||||
ViewCategories,
|
||||
ManageDiscounts,
|
||||
ViewDiscounts,
|
||||
ManageOrders,
|
||||
ViewAllOrders,
|
||||
ViewMineOrders,
|
||||
CreateOrder,
|
||||
ManageProducts,
|
||||
ViewProducts,
|
||||
ManageReview,
|
||||
AddReview,
|
||||
ConfirmReview,
|
||||
ViewAllReviews,
|
||||
ViewMineReviews,
|
||||
ManageWarehouses,
|
||||
ViewWarehouses,
|
||||
ManageShipping,
|
||||
ViewShipping,
|
||||
ManageUsers,
|
||||
ViewUsers,
|
||||
ManageFiles,
|
||||
ViewFiles
|
||||
ViewBlogCategories,
|
||||
ManageBlogCategories
|
||||
};
|
||||
|
||||
public static List<Claim> AllClaims = new List<Claim>
|
||||
{
|
||||
ManageBlogs.GetClaim,
|
||||
ViewBlogs.GetClaim,
|
||||
ManageBrands.GetClaim,
|
||||
ViewBrands.GetClaim,
|
||||
ManageCategories.GetClaim,
|
||||
ViewCategories.GetClaim,
|
||||
ManageDiscounts.GetClaim,
|
||||
ViewDiscounts.GetClaim,
|
||||
ManageOrders.GetClaim,
|
||||
ViewAllOrders.GetClaim,
|
||||
ViewMineOrders.GetClaim,
|
||||
CreateOrder.GetClaim,
|
||||
ManageProducts.GetClaim,
|
||||
ViewProducts.GetClaim,
|
||||
ManageReview.GetClaim,
|
||||
AddReview.GetClaim,
|
||||
ConfirmReview.GetClaim,
|
||||
ViewAllReviews.GetClaim,
|
||||
ViewMineReviews.GetClaim,
|
||||
ManageWarehouses.GetClaim,
|
||||
ViewWarehouses.GetClaim,
|
||||
ManageShipping.GetClaim,
|
||||
ViewShipping.GetClaim,
|
||||
ManageUsers.GetClaim,
|
||||
ViewUsers.GetClaim,
|
||||
ManageFiles.GetClaim,
|
||||
ViewFiles.GetClaim
|
||||
ViewBlogCategories.GetClaim,
|
||||
ManageBlogCategories.GetClaim
|
||||
};
|
||||
|
||||
public static List<Claim> ManagerClaims = new List<Claim>
|
||||
{
|
||||
ManageBlogs.GetClaim,
|
||||
ViewBlogs.GetClaim,
|
||||
ViewBlogCategories.GetClaim,
|
||||
ManageBlogCategories.GetClaim
|
||||
};
|
||||
|
||||
|
||||
public static List<Claim> CustomerClaims = new List<Claim>
|
||||
{
|
||||
ViewBlogs.GetClaim,
|
||||
ViewBrands.GetClaim,
|
||||
ViewCategories.GetClaim,
|
||||
ViewMineOrders.GetClaim,
|
||||
CreateOrder.GetClaim,
|
||||
ViewProducts.GetClaim,
|
||||
AddReview.GetClaim,
|
||||
ViewMineReviews.GetClaim,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -5,38 +5,7 @@ public static class ApplicationPermission
|
|||
public const string ManageBlogs = nameof(ManageBlogs);
|
||||
public const string ViewBlogs = nameof(ManageBlogs);
|
||||
|
||||
public const string ManageBrands = nameof(ManageBrands);
|
||||
public const string ViewBrands = nameof(ViewBrands);
|
||||
|
||||
public const string ManageCategories = nameof(ManageCategories);
|
||||
public const string ViewCategories = nameof(ViewCategories);
|
||||
|
||||
public const string ManageDiscounts = nameof(ManageDiscounts);
|
||||
public const string ViewDiscounts = nameof(ViewDiscounts);
|
||||
|
||||
public const string ManageOrders = nameof(ManageOrders);
|
||||
public const string ViewAllOrders = nameof(ViewAllOrders);
|
||||
public const string ViewMineOrders = nameof(ViewMineOrders);
|
||||
public const string CreateOrder = nameof(CreateOrder);
|
||||
|
||||
public const string ManageProducts = nameof(ManageProducts);
|
||||
public const string ViewProducts = nameof(ViewProducts);
|
||||
|
||||
public const string ManageReview = nameof(AddReview);
|
||||
public const string AddReview = nameof(AddReview);
|
||||
public const string ConfirmReview = nameof(ConfirmReview);
|
||||
public const string ViewAllReviews = nameof(ViewAllReviews);
|
||||
public const string ViewMineReviews = nameof(ViewMineReviews);
|
||||
|
||||
public const string ManageWarehouses = nameof(ManageWarehouses);
|
||||
public const string ViewWarehouses = nameof(ViewWarehouses);
|
||||
|
||||
public const string ManageShipping = nameof(ManageShipping);
|
||||
public const string ViewShipping = nameof(ViewShipping);
|
||||
|
||||
public const string ManageUsers = nameof(ManageUsers);
|
||||
public const string ViewUsers = nameof(ViewUsers);
|
||||
|
||||
public const string ManageFiles = nameof(ManageFiles);
|
||||
public const string ViewFiles = nameof(ViewFiles);
|
||||
public const string ManageBlogCategories = nameof(ManageBlogCategories);
|
||||
public const string ViewBlogCategories = nameof(ViewBlogCategories);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
namespace HiVakil.Repository.Handlers.BlogCategories;
|
||||
|
||||
public class CreateBlogCategoryCommandHandler : IRequestHandler<CreateBlogCategoryCommand,bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public CreateBlogCategoryCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(CreateBlogCategoryCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = BlogCategory.Create(request.Name, request.Description);
|
||||
_repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.Add(ent);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
namespace HiVakil.Repository.Handlers.BlogCategories;
|
||||
|
||||
public class DeleteBlogCategoryCommandHandler : IRequestHandler<DeleteBlogCategoryCommand,bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public DeleteBlogCategoryCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(DeleteBlogCategoryCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = await _repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(bc => bc.Id == request.Id, cancellationToken);
|
||||
if (ent == null)
|
||||
throw new AppException("Blog Category not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
_repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.Delete(ent);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
namespace HiVakil.Repository.Handlers.BlogCategories;
|
||||
|
||||
public class GetBlogCategoriesQueryHandler : IRequestHandler<GetBlogCategoriesQuery,List<BlogCategorySDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetBlogCategoriesQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<List<BlogCategorySDto>> Handle(GetBlogCategoriesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
return await _repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.TableNoTracking
|
||||
.Skip(request.Page * 20)
|
||||
.Take(20)
|
||||
.Select(BlogCategoryMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
namespace HiVakil.Repository.Handlers.BlogCategories;
|
||||
|
||||
public class GetBlogCategoryCommandHandler : IRequestHandler<GetBlogCategoryQuery,BlogCategoryLDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetBlogCategoryCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<BlogCategoryLDto> Handle(GetBlogCategoryQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = await _repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.TableNoTracking
|
||||
.Where(bc => bc.Id == request.Id)
|
||||
.Select(BlogCategoryMapper.ProjectToLDto)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
if (ent == null)
|
||||
throw new AppException("BlogCategory not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
return ent;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
namespace HiVakil.Repository.Handlers.BlogCategories;
|
||||
|
||||
public class UpdateBlogCategoryCommandHandler : IRequestHandler<UpdateBlogCategoryCommand,bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public UpdateBlogCategoryCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(UpdateBlogCategoryCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = await _repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(bc => bc.Id == request.Id, cancellationToken);
|
||||
if (ent == null)
|
||||
throw new AppException("Blog Category not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newEnt = BlogCategory.Create(request.Name, request.Description);
|
||||
newEnt.CreatedAt = ent.CreatedAt;
|
||||
newEnt.CreatedBy = ent.CreatedBy;
|
||||
newEnt.Id = ent.Id;
|
||||
|
||||
_repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.Update(newEnt);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
namespace HiVakil.Repository.Handlers.BlogCategories.Validators;
|
||||
|
||||
public class CreateBlogCategoryCommandValidator : AbstractValidator<CreateBlogCategoryCommand>
|
||||
{
|
||||
public CreateBlogCategoryCommandValidator()
|
||||
{
|
||||
RuleFor(cb => cb.Name)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithMessage("نام دسته بندی را وارد کنید");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
namespace HiVakil.Repository.Handlers.Blogs;
|
||||
|
||||
public class CreateBlogCommandHandler : IRequestHandler<CreateBlogCommand,bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public CreateBlogCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(CreateBlogCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = Blog.Create(request.Title, request.Content, request.Tags, request.ReadingTime, request.Summery,
|
||||
request.IsSuggested, request.CategoryId);
|
||||
|
||||
foreach (var file in request.Files)
|
||||
{
|
||||
ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||
}
|
||||
|
||||
_repositoryWrapper.SetRepository<Blog>()
|
||||
.Add(ent);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
namespace HiVakil.Repository.Handlers.Blogs;
|
||||
|
||||
public class DeleteBlogCommandHandler :IRequestHandler<DeleteBlogCommand,bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public DeleteBlogCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(DeleteBlogCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = await _repositoryWrapper.SetRepository<Blog>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(b => b.Id == request.Id, cancellationToken);
|
||||
|
||||
if (ent == null)
|
||||
throw new AppException("Blog is not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
_repositoryWrapper.SetRepository<Blog>()
|
||||
.Delete(ent);
|
||||
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
namespace HiVakil.Repository.Handlers.Blogs;
|
||||
|
||||
public class GetBlogQueryHandler : IRequestHandler<GetBlogQuery, BlogLDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetBlogQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<BlogLDto> Handle(GetBlogQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var blog = await _repositoryWrapper.SetRepository<Blog>()
|
||||
.TableNoTracking
|
||||
.Where(b => b.Id == request.Id)
|
||||
.Select(BlogMapper.ProjectToLDto)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
if (blog == null)
|
||||
throw new AppException("Blog not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
return blog;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
namespace HiVakil.Repository.Handlers.Blogs;
|
||||
|
||||
public class GetBlogsQueryHandler : IRequestHandler<GetBlogsQuery,GetBlogsResponseDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetBlogsQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<GetBlogsResponseDto> Handle(GetBlogsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var originals = _repositoryWrapper.SetRepository<Blog>()
|
||||
.TableNoTracking;
|
||||
|
||||
var blogs = await originals.Skip(request.Page * 20)
|
||||
.Take(20)
|
||||
.Select(BlogMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var response = new GetBlogsResponseDto();
|
||||
response.Blogs = blogs;
|
||||
response.Pager.CurrentPage = request.Page;
|
||||
response.Pager.TotalItems = await originals.CountAsync(cancellationToken);
|
||||
response.Pager.TotalPage = response.Pager.TotalItems / 20;
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
namespace HiVakil.Repository.Handlers.Blogs;
|
||||
|
||||
public class UpdateBlogCommandHandler : IRequestHandler<UpdateBlogCommand,bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public UpdateBlogCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(UpdateBlogCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var ent = await _repositoryWrapper.SetRepository<Blog>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(b => b.Id == request.Id, cancellationToken);
|
||||
|
||||
if (ent == null)
|
||||
throw new AppException("Blog not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newEnt = Blog.Create(request.Title, request.Content, request.Tags, request.ReadingTime, request.Summery,
|
||||
request.IsSuggested, request.CategoryId);
|
||||
|
||||
newEnt.CreatedAt = ent.CreatedAt;
|
||||
newEnt.CreatedBy = ent.CreatedBy;
|
||||
newEnt.Id = ent.Id;
|
||||
|
||||
_repositoryWrapper.SetRepository<Blog>()
|
||||
.Update(newEnt);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
namespace HiVakil.Repository.Handlers.Blogs.Validators;
|
||||
|
||||
public class CreateBlogCommandValidator : AbstractValidator<CreateBlogCommand>
|
||||
{
|
||||
public CreateBlogCommandValidator()
|
||||
{
|
||||
RuleFor(b => b.Content)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithMessage("محتوا بلاگ نمی تواند خالی باشد");
|
||||
|
||||
RuleFor(b => b.Title)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithMessage("عنوان بلاگ را وارد کنید");
|
||||
|
||||
RuleFor(b => b.Tags)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithMessage("تگ های بلاگ را وارد کنید");
|
||||
|
||||
RuleFor(b => b.Summery)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithMessage("خلاصه بلاگ را واردی کنید");
|
||||
}
|
||||
}
|
|
@ -39,8 +39,15 @@
|
|||
<Using Include="HiVakil.Common.Models.Api" />
|
||||
<Using Include="HiVakil.Common.Models.Entity" />
|
||||
<Using Include="HiVakil.Common.Models.Exception" />
|
||||
<Using Include="HiVakil.Domain.CommandQueries.Commands" />
|
||||
<Using Include="HiVakil.Domain.CommandQueries.Queries" />
|
||||
<Using Include="HiVakil.Domain.Dtos.LargDto" />
|
||||
<Using Include="HiVakil.Domain.Dtos.ResponseDto" />
|
||||
<Using Include="HiVakil.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="HiVakil.Domain.Entities.Blogs" />
|
||||
<Using Include="HiVakil.Domain.Entities.Users" />
|
||||
<Using Include="HiVakil.Domain.Enums" />
|
||||
<Using Include="HiVakil.Domain.Mappers" />
|
||||
<Using Include="HiVakil.Domain.Models.Claims" />
|
||||
<Using Include="HiVakil.Domain.Models.Settings" />
|
||||
<Using Include="HiVakil.Repository.Abstracts" />
|
||||
|
@ -65,4 +72,9 @@
|
|||
<Using Include="System.Reflection" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Handlers\Blogs\Validators\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,847 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using HiVakil.Repository.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace HiVakil.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20240227185334_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("public")
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("CategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsSuggested")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ReadingTime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Summery")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Tags")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Blogs", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogCategory", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("BlogCategories", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategory", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LawyerCategories", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategoryUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("CategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("LawyerCategoryUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LegalForms.LegalForm", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LegalForms", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LegalRequests.LegalRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LegalRequests", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.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")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasMaxLength(13)
|
||||
.HasColumnType("character varying(13)");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Rate")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Reviews", "public");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Review");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.StorageFiles.StorageFile", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasMaxLength(21)
|
||||
.HasColumnType("character varying(21)");
|
||||
|
||||
b.Property<string>("FileLocation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FileType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsHeader")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsPrimary")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StorageFiles", "public");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("StorageFile");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.ApplicationRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EnglishName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PersianName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("Roles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("BirthDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("City")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("CityId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NationalId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SignUpStatus")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("Users", "public");
|
||||
|
||||
b.UseTptMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.UserCallRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserCallRequests", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("RoleClaims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Claims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Logins", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("UserRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("Tokens", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Reviews.LawyerReview", b =>
|
||||
{
|
||||
b.HasBaseType("HiVakil.Domain.Entities.Reviews.Review");
|
||||
|
||||
b.Property<Guid>("ApplicationUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("ApplicationUserId");
|
||||
|
||||
b.HasDiscriminator().HasValue("LawyerReview");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogStorageFile", b =>
|
||||
{
|
||||
b.HasBaseType("HiVakil.Domain.Entities.StorageFiles.StorageFile");
|
||||
|
||||
b.Property<Guid>("BlogId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("BlogId");
|
||||
|
||||
b.HasDiscriminator().HasValue("BlogStorageFile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.Lawyer", b =>
|
||||
{
|
||||
b.HasBaseType("HiVakil.Domain.Entities.Users.ApplicationUser");
|
||||
|
||||
b.Property<string>("LawyerCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.ToTable("Lawyers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Blogs.BlogCategory", "Category")
|
||||
.WithMany("Blogs")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategoryUser", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.LawyerCategories.LawyerCategory", "Category")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Reviews.LawyerReview", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogStorageFile", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Blogs.Blog", "Blog")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("BlogId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Blog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("HiVakil.Domain.Entities.Users.Lawyer", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.Navigation("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogCategory", b =>
|
||||
{
|
||||
b.Navigation("Blogs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategory", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,596 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace HiVakil.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "public");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BlogCategories",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BlogCategories", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LawyerCategories",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LawyerCategories", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LegalForms",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LegalForms", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LegalRequests",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LegalRequests", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Roles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
EnglishName = table.Column<string>(type: "text", nullable: false),
|
||||
PersianName = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Roles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserCallRequests",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FullName = table.Column<string>(type: "text", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "text", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
Message = table.Column<string>(type: "text", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserCallRequests", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FirstName = table.Column<string>(type: "text", nullable: false),
|
||||
LastName = table.Column<string>(type: "text", nullable: false),
|
||||
NationalId = table.Column<string>(type: "text", nullable: false),
|
||||
City = table.Column<string>(type: "text", nullable: false),
|
||||
CityId = table.Column<int>(type: "integer", nullable: false),
|
||||
BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
Gender = table.Column<int>(type: "integer", nullable: false),
|
||||
SignUpStatus = table.Column<int>(type: "integer", nullable: false),
|
||||
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
PasswordHash = table.Column<string>(type: "text", nullable: true),
|
||||
SecurityStamp = table.Column<string>(type: "text", nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
|
||||
PhoneNumber = table.Column<string>(type: "text", nullable: true),
|
||||
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Blogs",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Content = table.Column<string>(type: "text", nullable: false),
|
||||
Tags = table.Column<string>(type: "text", nullable: false),
|
||||
ReadingTime = table.Column<int>(type: "integer", nullable: false),
|
||||
Summery = table.Column<string>(type: "text", nullable: false),
|
||||
IsSuggested = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CategoryId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Blogs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Blogs_BlogCategories_CategoryId",
|
||||
column: x => x.CategoryId,
|
||||
principalSchema: "public",
|
||||
principalTable: "BlogCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RoleClaims",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RoleClaims_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Claims",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Claims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Claims_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LawyerCategoryUsers",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CategoryId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LawyerCategoryUsers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LawyerCategoryUsers_LawyerCategories_CategoryId",
|
||||
column: x => x.CategoryId,
|
||||
principalSchema: "public",
|
||||
principalTable: "LawyerCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LawyerCategoryUsers_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Lawyers",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
LawyerCode = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Lawyers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lawyers_Users_Id",
|
||||
column: x => x.Id,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Logins",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderKey = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Logins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
table.ForeignKey(
|
||||
name: "FK_Logins_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Reviews",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Comment = table.Column<string>(type: "text", nullable: false),
|
||||
Rate = table.Column<double>(type: "double precision", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Discriminator = table.Column<string>(type: "character varying(13)", maxLength: 13, nullable: false),
|
||||
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Reviews", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Reviews_Users_ApplicationUserId",
|
||||
column: x => x.ApplicationUserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tokens",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_Tokens_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserRoles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserRoles_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserRoles_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StorageFiles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
FileLocation = table.Column<string>(type: "text", nullable: false),
|
||||
FileName = table.Column<string>(type: "text", nullable: false),
|
||||
IsHeader = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsPrimary = table.Column<bool>(type: "boolean", nullable: false),
|
||||
FileType = table.Column<int>(type: "integer", nullable: false),
|
||||
Discriminator = table.Column<string>(type: "character varying(21)", maxLength: 21, nullable: false),
|
||||
BlogId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StorageFiles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_StorageFiles_Blogs_BlogId",
|
||||
column: x => x.BlogId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Blogs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Blogs_CategoryId",
|
||||
schema: "public",
|
||||
table: "Blogs",
|
||||
column: "CategoryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Claims_UserId",
|
||||
schema: "public",
|
||||
table: "Claims",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LawyerCategoryUsers_CategoryId",
|
||||
schema: "public",
|
||||
table: "LawyerCategoryUsers",
|
||||
column: "CategoryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LawyerCategoryUsers_UserId",
|
||||
schema: "public",
|
||||
table: "LawyerCategoryUsers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Logins_UserId",
|
||||
schema: "public",
|
||||
table: "Logins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Reviews_ApplicationUserId",
|
||||
schema: "public",
|
||||
table: "Reviews",
|
||||
column: "ApplicationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RoleClaims_RoleId",
|
||||
schema: "public",
|
||||
table: "RoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "RoleNameIndex",
|
||||
schema: "public",
|
||||
table: "Roles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StorageFiles_BlogId",
|
||||
schema: "public",
|
||||
table: "StorageFiles",
|
||||
column: "BlogId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserRoles_RoleId",
|
||||
schema: "public",
|
||||
table: "UserRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "EmailIndex",
|
||||
schema: "public",
|
||||
table: "Users",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
schema: "public",
|
||||
table: "Users",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Claims",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LawyerCategoryUsers",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lawyers",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LegalForms",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LegalRequests",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Logins",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Reviews",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RoleClaims",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StorageFiles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tokens",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserCallRequests",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserRoles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LawyerCategories",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Blogs",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Roles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BlogCategories",
|
||||
schema: "public");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,844 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using HiVakil.Repository.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace HiVakil.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
partial class ApplicationContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("public")
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("CategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsSuggested")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ReadingTime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Summery")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Tags")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Blogs", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogCategory", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("BlogCategories", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategory", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LawyerCategories", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategoryUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("CategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("LawyerCategoryUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LegalForms.LegalForm", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LegalForms", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LegalRequests.LegalRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LegalRequests", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.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")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasMaxLength(13)
|
||||
.HasColumnType("character varying(13)");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Rate")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Reviews", "public");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Review");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.StorageFiles.StorageFile", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasMaxLength(21)
|
||||
.HasColumnType("character varying(21)");
|
||||
|
||||
b.Property<string>("FileLocation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FileType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsHeader")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsPrimary")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StorageFiles", "public");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("StorageFile");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.ApplicationRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EnglishName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PersianName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("Roles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("BirthDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("City")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("CityId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NationalId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SignUpStatus")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("Users", "public");
|
||||
|
||||
b.UseTptMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.UserCallRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserCallRequests", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("RoleClaims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Claims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Logins", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("UserRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("Tokens", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Reviews.LawyerReview", b =>
|
||||
{
|
||||
b.HasBaseType("HiVakil.Domain.Entities.Reviews.Review");
|
||||
|
||||
b.Property<Guid>("ApplicationUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("ApplicationUserId");
|
||||
|
||||
b.HasDiscriminator().HasValue("LawyerReview");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogStorageFile", b =>
|
||||
{
|
||||
b.HasBaseType("HiVakil.Domain.Entities.StorageFiles.StorageFile");
|
||||
|
||||
b.Property<Guid>("BlogId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("BlogId");
|
||||
|
||||
b.HasDiscriminator().HasValue("BlogStorageFile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.Lawyer", b =>
|
||||
{
|
||||
b.HasBaseType("HiVakil.Domain.Entities.Users.ApplicationUser");
|
||||
|
||||
b.Property<string>("LawyerCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.ToTable("Lawyers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Blogs.BlogCategory", "Category")
|
||||
.WithMany("Blogs")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategoryUser", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.LawyerCategories.LawyerCategory", "Category")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Reviews.LawyerReview", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogStorageFile", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Blogs.Blog", "Blog")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("BlogId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Blog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Users.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("HiVakil.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("HiVakil.Domain.Entities.Users.Lawyer", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.Navigation("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.Blogs.BlogCategory", b =>
|
||||
{
|
||||
b.Navigation("Blogs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HiVakil.Domain.Entities.LawyerCategories.LawyerCategory", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ public class ApplicationContext : IdentityDbContext<ApplicationUser, Application
|
|||
builder.HasDefaultSchema("public");
|
||||
|
||||
builder.Entity<ApplicationUser>().ToTable("Users");
|
||||
builder.Entity<Lawyer>().ToTable("Lawyers");
|
||||
builder.Entity<ApplicationRole>().ToTable("Roles");
|
||||
builder.Entity<IdentityRoleClaim<Guid>>().ToTable("RoleClaims");
|
||||
builder.Entity<IdentityUserRole<Guid>>().ToTable("UserRoles");
|
||||
|
|
Loading…
Reference in New Issue