Tenant Seed düzenlemesi
This commit is contained in:
parent
8c8e214e78
commit
d9f021c0f1
42 changed files with 392 additions and 266 deletions
|
|
@ -1,93 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Volo.Abp.Application.Dtos;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Blog;
|
|
||||||
|
|
||||||
public class BlogPostDto : FullAuditedEntityDto<Guid>
|
|
||||||
{
|
|
||||||
public Guid? TenantId { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public string ContentTr { get; set; }
|
|
||||||
public string ContentEn { get; set; }
|
|
||||||
public string Summary { get; set; }
|
|
||||||
public string CoverImage { get; set; }
|
|
||||||
|
|
||||||
public Guid CategoryId { get; set; }
|
|
||||||
public BlogCategoryDto Category { get; set; }
|
|
||||||
|
|
||||||
public AuthorDto Author { get; set; }
|
|
||||||
|
|
||||||
public int ViewCount { get; set; }
|
|
||||||
public int LikeCount { get; set; }
|
|
||||||
public int CommentCount { get; set; }
|
|
||||||
|
|
||||||
public bool IsPublished { get; set; }
|
|
||||||
public DateTime? PublishedAt { get; set; }
|
|
||||||
|
|
||||||
public List<string> Tags { get; set; }
|
|
||||||
public bool IsLiked { get; set; }
|
|
||||||
|
|
||||||
public BlogPostDto()
|
|
||||||
{
|
|
||||||
Tags = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AuthorDto
|
|
||||||
{
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Avatar { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CreateUpdateBlogPostDto
|
|
||||||
{
|
|
||||||
public Guid? TenantId { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public string ContentTr { get; set; }
|
|
||||||
public string ContentEn { get; set; }
|
|
||||||
public string Summary { get; set; }
|
|
||||||
public string ReadTime { get; set; }
|
|
||||||
public string CoverImage { get; set; }
|
|
||||||
public Guid CategoryId { get; set; }
|
|
||||||
public List<string> Tags { get; set; }
|
|
||||||
public bool IsPublished { get; set; }
|
|
||||||
|
|
||||||
public CreateUpdateBlogPostDto()
|
|
||||||
{
|
|
||||||
Tags = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BlogPostListDto : EntityDto<Guid>
|
|
||||||
{
|
|
||||||
public Guid? TenantId { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public string Summary { get; set; }
|
|
||||||
public string ReadTime { get; set; }
|
|
||||||
public string CoverImage { get; set; }
|
|
||||||
public string ContentTr { get; set; }
|
|
||||||
public string ContentEn { get; set; }
|
|
||||||
|
|
||||||
public BlogCategoryDto Category { get; set; }
|
|
||||||
public AuthorDto Author { get; set; }
|
|
||||||
|
|
||||||
public int ViewCount { get; set; }
|
|
||||||
public int LikeCount { get; set; }
|
|
||||||
public int CommentCount { get; set; }
|
|
||||||
|
|
||||||
public bool IsPublished { get; set; }
|
|
||||||
public DateTime? PublishedAt { get; set; }
|
|
||||||
public DateTime CreationTime { get; set; }
|
|
||||||
|
|
||||||
public List<string> Tags { get; set; }
|
|
||||||
|
|
||||||
public BlogPostListDto()
|
|
||||||
{
|
|
||||||
Tags = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Abouts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class AboutDto : EntityDto<Guid>
|
public class AboutDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class AuthorDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Blog;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class BlogCategoryDto : FullAuditedEntityDto<Guid>
|
public class BlogCategoryDto : FullAuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -15,13 +15,4 @@ public class BlogCategoryDto : FullAuditedEntityDto<Guid>
|
||||||
public int PostCount { get; set; }
|
public int PostCount { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateUpdateBlogCategoryDto
|
|
||||||
{
|
|
||||||
public Guid? TenantId { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public string Icon { get; set; }
|
|
||||||
public int DisplayOrder { get; set; }
|
|
||||||
public bool IsActive { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Blog;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class BlogPostAndCategoriesDto
|
public class BlogPostAndCategoriesDto
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class BlogPostDto : FullAuditedEntityDto<Guid>
|
||||||
|
{
|
||||||
|
public Guid? TenantId { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
|
public string ContentTr { get; set; }
|
||||||
|
public string ContentEn { get; set; }
|
||||||
|
public string Summary { get; set; }
|
||||||
|
public string CoverImage { get; set; }
|
||||||
|
|
||||||
|
public Guid CategoryId { get; set; }
|
||||||
|
public BlogCategoryDto Category { get; set; }
|
||||||
|
|
||||||
|
public AuthorDto Author { get; set; }
|
||||||
|
|
||||||
|
public int ViewCount { get; set; }
|
||||||
|
public int LikeCount { get; set; }
|
||||||
|
public int CommentCount { get; set; }
|
||||||
|
|
||||||
|
public bool IsPublished { get; set; }
|
||||||
|
public DateTime? PublishedAt { get; set; }
|
||||||
|
|
||||||
|
public List<string> Tags { get; set; }
|
||||||
|
public bool IsLiked { get; set; }
|
||||||
|
|
||||||
|
public BlogPostDto()
|
||||||
|
{
|
||||||
|
Tags = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class BlogPostListDto : EntityDto<Guid>
|
||||||
|
{
|
||||||
|
public Guid? TenantId { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
|
public string Summary { get; set; }
|
||||||
|
public string ReadTime { get; set; }
|
||||||
|
public string CoverImage { get; set; }
|
||||||
|
public string ContentTr { get; set; }
|
||||||
|
public string ContentEn { get; set; }
|
||||||
|
|
||||||
|
public BlogCategoryDto Category { get; set; }
|
||||||
|
public AuthorDto Author { get; set; }
|
||||||
|
|
||||||
|
public int ViewCount { get; set; }
|
||||||
|
public int LikeCount { get; set; }
|
||||||
|
public int CommentCount { get; set; }
|
||||||
|
|
||||||
|
public bool IsPublished { get; set; }
|
||||||
|
public DateTime? PublishedAt { get; set; }
|
||||||
|
public DateTime CreationTime { get; set; }
|
||||||
|
|
||||||
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
|
public BlogPostListDto()
|
||||||
|
{
|
||||||
|
Tags = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class CityDto : AuditedEntityDto<Guid>
|
public class CityDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -3,7 +3,7 @@ using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class ContactDto : EntityDto<Guid>
|
public class ContactDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -51,31 +51,4 @@ public class ContactDto : EntityDto<Guid>
|
||||||
}
|
}
|
||||||
set { MapJson = JsonSerializer.Serialize(value); }
|
set { MapJson = JsonSerializer.Serialize(value); }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class BankDto
|
|
||||||
{
|
|
||||||
public string AccountHolder { get; set; }
|
|
||||||
public string Branch { get; set; }
|
|
||||||
public string AccountNumber { get; set; }
|
|
||||||
public string Iban { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class WorkHoursDto
|
|
||||||
{
|
|
||||||
public string Weekday { get; set; }
|
|
||||||
public string Weekend { get; set; }
|
|
||||||
public string Whatsapp { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MapDto
|
|
||||||
{
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Src { get; set; }
|
|
||||||
public string Width { get; set; }
|
|
||||||
public string Height { get; set; }
|
|
||||||
public string Style { get; set; }
|
|
||||||
public bool? AllowFullScreen { get; set; }
|
|
||||||
public string Loading { get; set; }
|
|
||||||
public string ReferrerPolicy { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class ContactTagDto : AuditedEntityDto<Guid>
|
public class ContactTagDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class ContactTitleDto : AuditedEntityDto<Guid>
|
public class ContactTitleDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class CountryDto : AuditedEntityDto<Guid>
|
public class CountryDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class CountryGroupDto : AuditedEntityDto<Guid>
|
public class CountryGroupDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class CreateUpdateBlogCategoryDto
|
||||||
|
{
|
||||||
|
public Guid? TenantId { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string Icon { get; set; }
|
||||||
|
public int DisplayOrder { get; set; }
|
||||||
|
public bool IsActive { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class CreateUpdateBlogPostDto
|
||||||
|
{
|
||||||
|
public Guid? TenantId { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
|
public string ContentTr { get; set; }
|
||||||
|
public string ContentEn { get; set; }
|
||||||
|
public string Summary { get; set; }
|
||||||
|
public string ReadTime { get; set; }
|
||||||
|
public string CoverImage { get; set; }
|
||||||
|
public Guid CategoryId { get; set; }
|
||||||
|
public List<string> Tags { get; set; }
|
||||||
|
public bool IsPublished { get; set; }
|
||||||
|
|
||||||
|
public CreateUpdateBlogPostDto()
|
||||||
|
{
|
||||||
|
Tags = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Contacts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class DistrictDto : AuditedEntityDto<Guid>
|
public class DistrictDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
|
|
||||||
namespace Kurs.Platform.Blog;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public interface IBlogAppService : IApplicationService
|
public interface IBlogAppService : IApplicationService
|
||||||
{
|
{
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Orders;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class InstallmentOptionDto : EntityDto<Guid>
|
public class InstallmentOptionDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using Kurs.Platform.Tenants;
|
using Kurs.Platform.Tenants;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Orders;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class OrderDto : EntityDto<Guid>
|
public class OrderDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -21,11 +21,3 @@ public class OrderDto : EntityDto<Guid>
|
||||||
public Dictionary<string, object> PaymentData { get; set; }
|
public Dictionary<string, object> PaymentData { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrderItemDto
|
|
||||||
{
|
|
||||||
public Guid ProductId { get; set; }
|
|
||||||
public ProductDto Product { get; set; }
|
|
||||||
public string BillingCycle { get; set; } // monthly | yearly
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
public decimal TotalPrice { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class OrderItemDto
|
||||||
|
{
|
||||||
|
public Guid ProductId { get; set; }
|
||||||
|
public ProductDto Product { get; set; }
|
||||||
|
public string BillingCycle { get; set; } // monthly | yearly
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
public decimal TotalPrice { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Orders;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class PaymentMethodDto : EntityDto<Guid>
|
public class PaymentMethodDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Orders;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class ProductDto : EntityDto<Guid>
|
public class ProductDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
|
|
||||||
namespace Kurs.Platform.Services;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class ServiceDto : FullAuditedEntityDto<Guid>
|
public class ServiceDto : FullAuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.Extensions.Localization;
|
||||||
using Volo.Abp.Domain.Repositories;
|
using Volo.Abp.Domain.Repositories;
|
||||||
using Volo.Abp.Users;
|
using Volo.Abp.Users;
|
||||||
|
|
||||||
namespace Kurs.Platform.Blog;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class BlogAppService : PlatformAppService, IBlogAppService
|
public class BlogAppService : PlatformAppService, IBlogAppService
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,16 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Kurs.Platform.Entities;
|
using Kurs.Platform.Entities;
|
||||||
using Kurs.Platform.Services;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
using Volo.Abp.Domain.Repositories;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Kurs.Platform.Data.Seeds;
|
using Kurs.Platform.Data.Seeds;
|
||||||
using Kurs.Sender.Mail;
|
using Kurs.Sender.Mail;
|
||||||
using Volo.Abp.Settings;
|
using Volo.Abp.Settings;
|
||||||
using Kurs.Platform.Demos;
|
using Kurs.Platform.Demos;
|
||||||
using Kurs.Platform.Blog;
|
|
||||||
using Volo.Abp.Domain.Entities;
|
using Volo.Abp.Domain.Entities;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
using Kurs.Platform.Orders;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Kurs.Platform.Abouts;
|
|
||||||
using Kurs.Platform.Contacts;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Public;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Kurs.Platform.Abouts;
|
|
||||||
using Kurs.Platform.Blog;
|
|
||||||
using Kurs.Platform.Contacts;
|
|
||||||
using Kurs.Platform.Demos;
|
using Kurs.Platform.Demos;
|
||||||
using Kurs.Platform.Entities;
|
using Kurs.Platform.Entities;
|
||||||
using Kurs.Platform.Orders;
|
|
||||||
using Kurs.Platform.Services;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Public;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,19 +29,6 @@
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<None Remove="Seeds\TenantData.json" />
|
|
||||||
<Content Include="Seeds\TenantData.json">
|
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Seeds\TenantData.Dev.json">
|
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Seeds\TenantData.Production.json">
|
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<None Remove="Seeds\HostData.json" />
|
<None Remove="Seeds\HostData.json" />
|
||||||
<Content Include="Seeds\HostData.json">
|
<Content Include="Seeds\HostData.json">
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using Volo.Abp.PermissionManagement;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using EFCore.BulkExtensions;
|
using EFCore.BulkExtensions;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Kurs.Platform.Contacts;
|
using Kurs.Platform.Public;
|
||||||
using static Kurs.Settings.SettingsConsts;
|
using static Kurs.Settings.SettingsConsts;
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
namespace Kurs.Platform.Data.Seeds;
|
||||||
|
|
|
||||||
9
api/src/Kurs.Platform.Domain.Shared/Public/BankDto.cs
Normal file
9
api/src/Kurs.Platform.Domain.Shared/Public/BankDto.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class BankDto
|
||||||
|
{
|
||||||
|
public string AccountHolder { get; set; }
|
||||||
|
public string Branch { get; set; }
|
||||||
|
public string AccountNumber { get; set; }
|
||||||
|
public string Iban { get; set; }
|
||||||
|
}
|
||||||
13
api/src/Kurs.Platform.Domain.Shared/Public/MapDto.cs
Normal file
13
api/src/Kurs.Platform.Domain.Shared/Public/MapDto.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class MapDto
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Src { get; set; }
|
||||||
|
public string Width { get; set; }
|
||||||
|
public string Height { get; set; }
|
||||||
|
public string Style { get; set; }
|
||||||
|
public bool? AllowFullScreen { get; set; }
|
||||||
|
public string Loading { get; set; }
|
||||||
|
public string ReferrerPolicy { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Kurs.Platform.Abouts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class SectionDto
|
public class SectionDto
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Kurs.Platform.Abouts;
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
public class StatDto
|
public class StatDto
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Kurs.Platform.Public;
|
||||||
|
|
||||||
|
public class WorkHoursDto
|
||||||
|
{
|
||||||
|
public string Weekday { get; set; }
|
||||||
|
public string Weekend { get; set; }
|
||||||
|
public string Whatsapp { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -21,8 +21,6 @@ using Volo.Abp.MultiTenancy;
|
||||||
using Volo.Abp.PermissionManagement;
|
using Volo.Abp.PermissionManagement;
|
||||||
using Volo.Abp.TenantManagement;
|
using Volo.Abp.TenantManagement;
|
||||||
using Volo.Abp.Uow;
|
using Volo.Abp.Uow;
|
||||||
using IdentityRole = Volo.Abp.Identity.IdentityRole;
|
|
||||||
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
|
||||||
using static Kurs.Settings.SettingsConsts;
|
using static Kurs.Settings.SettingsConsts;
|
||||||
|
|
||||||
namespace Kurs.Platform.Migrations;
|
namespace Kurs.Platform.Migrations;
|
||||||
|
|
@ -90,17 +88,19 @@ public class DatabaseMigrationEventHandler :
|
||||||
|
|
||||||
public async Task HandleEventAsync(ApplyDatabaseMigrationsEto eventData)
|
public async Task HandleEventAsync(ApplyDatabaseMigrationsEto eventData)
|
||||||
{
|
{
|
||||||
var schemaMigrated = false;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
schemaMigrated = await MigrateDatabaseSchemaAsync(eventData.TenantId);
|
var schemaMigrated = await MigrateDatabaseSchemaAsync(eventData.TenantId);
|
||||||
if (schemaMigrated)
|
if (schemaMigrated)
|
||||||
{
|
{
|
||||||
await SeedTenantDataAsync(eventData);
|
await SeedTenantDataAsync(eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Logger.LogError(ex, "Error while seeding tenant data");
|
||||||
|
throw;
|
||||||
|
|
||||||
//await HandleErrorOnApplyDatabaseMigrationAsync(eventData, ex);
|
//await HandleErrorOnApplyDatabaseMigrationAsync(eventData, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -189,80 +189,80 @@ public class DatabaseMigrationEventHandler :
|
||||||
{
|
{
|
||||||
using (CurrentTenant.Change(eventData.TenantId))
|
using (CurrentTenant.Change(eventData.TenantId))
|
||||||
{
|
{
|
||||||
// await DataSeeder.SeedAsync(
|
await DataSeeder.SeedAsync(
|
||||||
// new DataSeedContext(eventData.TenantId)
|
new DataSeedContext(eventData.TenantId)
|
||||||
// .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, eventData.Properties[IdentityDataSeedContributor.AdminEmailPropertyName])
|
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, eventData.Properties[IdentityDataSeedContributor.AdminEmailPropertyName])
|
||||||
// .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, eventData.Properties[IdentityDataSeedContributor.AdminPasswordPropertyName])
|
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, eventData.Properties[IdentityDataSeedContributor.AdminPasswordPropertyName])
|
||||||
// .WithProperty(IdentityDataSeedContributor.AdminUserNamePropertyName, eventData.Properties[IdentityDataSeedContributor.AdminUserNamePropertyName])
|
.WithProperty(IdentityDataSeedContributor.AdminUserNamePropertyName, eventData.Properties[IdentityDataSeedContributor.AdminUserNamePropertyName])
|
||||||
// );
|
);
|
||||||
|
|
||||||
await IdentityOptions.SetAsync();
|
// await IdentityOptions.SetAsync();
|
||||||
|
|
||||||
var result = new IdentityDataSeedResult();
|
// var result = new IdentityDataSeedResult();
|
||||||
var adminEmail = eventData.Properties[IdentityDataSeedContributor.AdminEmailPropertyName];
|
// var adminEmail = eventData.Properties[IdentityDataSeedContributor.AdminEmailPropertyName];
|
||||||
var adminPassword = eventData.Properties[IdentityDataSeedContributor.AdminPasswordPropertyName];
|
// var adminPassword = eventData.Properties[IdentityDataSeedContributor.AdminPasswordPropertyName];
|
||||||
var adminUserName = eventData.Properties[IdentityDataSeedContributor.AdminUserNamePropertyName];
|
// var adminUserName = eventData.Properties[IdentityDataSeedContributor.AdminUserNamePropertyName];
|
||||||
var adminUser = await UserRepository.FindByNormalizedUserNameAsync(
|
// var adminUser = await UserRepository.FindByNormalizedUserNameAsync(
|
||||||
LookupNormalizer.NormalizeName(adminUserName)
|
// LookupNormalizer.NormalizeName(adminUserName)
|
||||||
);
|
// );
|
||||||
|
|
||||||
adminUser = new IdentityUser(
|
// adminUser = new IdentityUser(
|
||||||
GuidGenerator.Create(),
|
// GuidGenerator.Create(),
|
||||||
adminUserName,
|
// adminUserName,
|
||||||
adminUserName,
|
// adminUserName,
|
||||||
eventData.TenantId
|
// eventData.TenantId
|
||||||
)
|
// )
|
||||||
{
|
// {
|
||||||
Name = PlatformConsts.AbpIdentity.User.AdminNameDefaultValue,
|
// Name = PlatformConsts.AbpIdentity.User.AdminNameDefaultValue,
|
||||||
Surname = PlatformConsts.AbpIdentity.User.AdminSurNameDefaultValue,
|
// Surname = PlatformConsts.AbpIdentity.User.AdminSurNameDefaultValue,
|
||||||
};
|
// };
|
||||||
adminUser.SetEmailConfirmed(true);
|
// adminUser.SetEmailConfirmed(true);
|
||||||
adminUser.SetIsVerified(true);
|
// adminUser.SetIsVerified(true);
|
||||||
adminUser.SetPhoneNumber(PlatformConsts.AbpIdentity.User.AdminPhoneNumberDefaultValue, true);
|
// adminUser.SetPhoneNumber(PlatformConsts.AbpIdentity.User.AdminPhoneNumberDefaultValue, true);
|
||||||
|
|
||||||
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
// (await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
||||||
result.CreatedAdminUser = true;
|
// result.CreatedAdminUser = true;
|
||||||
var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(PlatformConsts.AbpIdentity.User.AdminRoleName));
|
// var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(PlatformConsts.AbpIdentity.User.AdminRoleName));
|
||||||
if (adminRole is null)
|
// if (adminRole is null)
|
||||||
{
|
// {
|
||||||
adminRole = new IdentityRole(
|
// adminRole = new IdentityRole(
|
||||||
GuidGenerator.Create(),
|
// GuidGenerator.Create(),
|
||||||
PlatformConsts.AbpIdentity.User.AdminRoleName,
|
// PlatformConsts.AbpIdentity.User.AdminRoleName,
|
||||||
eventData.TenantId
|
// eventData.TenantId
|
||||||
)
|
// )
|
||||||
{
|
// {
|
||||||
IsStatic = true,
|
// IsStatic = true,
|
||||||
IsPublic = true
|
// IsPublic = true
|
||||||
};
|
// };
|
||||||
|
|
||||||
(await RoleManager.CreateAsync(adminRole)).CheckErrors();
|
// (await RoleManager.CreateAsync(adminRole)).CheckErrors();
|
||||||
result.CreatedAdminRole = true;
|
// result.CreatedAdminRole = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
(await UserManager.AddToRoleAsync(adminUser, adminRole.Name)).CheckErrors();
|
// (await UserManager.AddToRoleAsync(adminUser, adminRole.Name)).CheckErrors();
|
||||||
|
|
||||||
/*admin rolüne ait yetkiler otomatik atanıyor*/
|
// /*admin rolüne ait yetkiler otomatik atanıyor*/
|
||||||
var permissions = await PermissionGrantRepository.GetListAsync("R", PlatformConsts.AbpIdentity.User.AdminRoleName);
|
// var permissions = await PermissionGrantRepository.GetListAsync("R", PlatformConsts.AbpIdentity.User.AdminRoleName);
|
||||||
if (permissions.Count == 0)
|
// if (permissions.Count == 0)
|
||||||
{
|
// {
|
||||||
await PermissionGrantRepository.InsertManyAsync(
|
// await PermissionGrantRepository.InsertManyAsync(
|
||||||
[
|
// [
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Create, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Create, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Delete, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Delete, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Update, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Update, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Default + ".Export", "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.Default + ".Export", "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.ManagePermissions, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Roles.ManagePermissions, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Create, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Create, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Delete, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Delete, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Update, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Update, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.ManagePermissions, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.ManagePermissions, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Default + ".Export", "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.Default + ".Export", "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.ManageRoles, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.Users.ManageRoles, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.UserLookup.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
// new(Guid.NewGuid(), PlatformConsts.IdentityPermissions.UserLookup.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, eventData.TenantId),
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,28 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<Import Project="..\..\common.props" />
|
<Import Project="..\..\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<RootNamespace>Kurs.Platform</RootNamespace>
|
<RootNamespace>Kurs.Platform</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Tenants\Seeds\TenantData.json" />
|
||||||
|
<Content Include="Tenants\Seeds\TenantData.json">
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Tenants\Seeds\TenantData.Dev.json">
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Tenants\Seeds\TenantData.Production.json">
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EFCore.BulkExtensions" Version="9.0.1" />
|
<PackageReference Include="EFCore.BulkExtensions" Version="9.0.1" />
|
||||||
<ProjectReference Include="..\..\modules\Kurs.Languages\Kurs.Languages.EntityFrameworkCore\Kurs.Languages.EntityFrameworkCore.csproj" />
|
<ProjectReference Include="..\..\modules\Kurs.Languages\Kurs.Languages.EntityFrameworkCore\Kurs.Languages.EntityFrameworkCore.csproj" />
|
||||||
|
|
@ -24,30 +40,30 @@
|
||||||
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="9.0.2" />
|
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="9.0.2" />
|
||||||
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="9.0.2" />
|
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="9.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Migrations-Sql\**" />
|
<Compile Remove="Migrations-Sql\**" />
|
||||||
<Content Remove="Migrations-Sql\**" />
|
<Content Remove="Migrations-Sql\**" />
|
||||||
<EmbeddedResource Remove="Migrations-Sql\**" />
|
<EmbeddedResource Remove="Migrations-Sql\**" />
|
||||||
<None Remove="Migrations-Sql\**" />
|
<None Remove="Migrations-Sql\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Migrations-Pg\**" />
|
<Compile Remove="Migrations-Pg\**" />
|
||||||
<Content Remove="Migrations-Pg\**" />
|
<Content Remove="Migrations-Pg\**" />
|
||||||
<EmbeddedResource Remove="Migrations-Pg\**" />
|
<EmbeddedResource Remove="Migrations-Pg\**" />
|
||||||
<None Remove="Migrations-Pg\**" />
|
<None Remove="Migrations-Pg\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Dashboard\" />
|
<Folder Include="Dashboard\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -144,11 +144,15 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
public async Task SeedAsync(DataSeedContext context)
|
||||||
{
|
{
|
||||||
|
var assemblyLocation = Path.GetDirectoryName(typeof(TenantDataSeeder).Assembly.Location)!;
|
||||||
|
var basePath = Path.Combine(assemblyLocation, "Tenants", "Seeds");
|
||||||
|
|
||||||
var configuration = new ConfigurationBuilder()
|
var configuration = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(basePath)
|
||||||
.AddJsonFile(Path.Combine("Seeds", "TenantData.json"))
|
.AddJsonFile("TenantData.json", optional: false, reloadOnChange: false)
|
||||||
.AddJsonFile(Path.Combine("Seeds", $"TenantData.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? ""}.json"), true)
|
.AddJsonFile($"TenantData.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? ""}.json", optional: true)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var items = configuration.Get<TenantSeederDto>();
|
var items = configuration.Get<TenantSeederDto>();
|
||||||
|
|
||||||
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Kurs.Platform.Extensions;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Volo.Abp;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
using Volo.Abp.Guids;
|
||||||
|
using Volo.Abp.Identity;
|
||||||
|
using Volo.Abp.MultiTenancy;
|
||||||
|
using Volo.Abp.PermissionManagement;
|
||||||
|
using IdentityRole = Volo.Abp.Identity.IdentityRole;
|
||||||
|
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Data.Seeds;
|
||||||
|
|
||||||
|
[Dependency(ReplaceServices = true)]
|
||||||
|
public class TenantIdentityDataSeeder : IdentityDataSeeder
|
||||||
|
{
|
||||||
|
private readonly IPermissionGrantRepository permissionGrantRepository;
|
||||||
|
|
||||||
|
public TenantIdentityDataSeeder(
|
||||||
|
IGuidGenerator guidGenerator,
|
||||||
|
IIdentityRoleRepository roleRepository,
|
||||||
|
IIdentityUserRepository userRepository,
|
||||||
|
ILookupNormalizer lookupNormalizer,
|
||||||
|
IdentityUserManager userManager,
|
||||||
|
IdentityRoleManager roleManager,
|
||||||
|
IPermissionGrantRepository permissionGrantRepository,
|
||||||
|
ICurrentTenant currentTenant,
|
||||||
|
IOptions<IdentityOptions> identityOptions
|
||||||
|
) : base(guidGenerator, roleRepository, userRepository, lookupNormalizer, userManager, roleManager, currentTenant, identityOptions)
|
||||||
|
{
|
||||||
|
this.permissionGrantRepository = permissionGrantRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task<IdentityDataSeedResult> SeedAsync(string adminEmail, string adminPassword, Guid? tenantId = null, string adminUserName = null)
|
||||||
|
{
|
||||||
|
Check.NotNullOrWhiteSpace(adminEmail, nameof(adminEmail));
|
||||||
|
Check.NotNullOrWhiteSpace(adminPassword, nameof(adminPassword));
|
||||||
|
|
||||||
|
using (CurrentTenant.Change(tenantId))
|
||||||
|
{
|
||||||
|
await IdentityOptions.SetAsync();
|
||||||
|
|
||||||
|
var result = new IdentityDataSeedResult();
|
||||||
|
|
||||||
|
var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(PlatformConsts.AbpIdentity.User.AdminRoleName));
|
||||||
|
if (adminRole is null)
|
||||||
|
{
|
||||||
|
adminRole = new IdentityRole(
|
||||||
|
GuidGenerator.Create(),
|
||||||
|
PlatformConsts.AbpIdentity.User.AdminRoleName,
|
||||||
|
tenantId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IsStatic = true,
|
||||||
|
IsPublic = true
|
||||||
|
};
|
||||||
|
|
||||||
|
(await RoleManager.CreateAsync(adminRole)).CheckErrors();
|
||||||
|
result.CreatedAdminRole = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
adminUserName ??= PlatformConsts.AbpIdentity.User.AdminEmailDefaultValue;
|
||||||
|
var adminUser = await UserRepository.FindByNormalizedUserNameAsync(
|
||||||
|
LookupNormalizer.NormalizeName(adminUserName)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (adminUser is null)
|
||||||
|
{
|
||||||
|
adminUser = new IdentityUser(
|
||||||
|
GuidGenerator.Create(),
|
||||||
|
adminUserName,
|
||||||
|
adminEmail,
|
||||||
|
tenantId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Name = PlatformConsts.AbpIdentity.User.AdminNameDefaultValue,
|
||||||
|
Surname = PlatformConsts.AbpIdentity.User.AdminSurNameDefaultValue,
|
||||||
|
};
|
||||||
|
|
||||||
|
adminUser.SetEmailConfirmed(true);
|
||||||
|
adminUser.SetIsVerified(true);
|
||||||
|
adminUser.SetRocketUsername(PlatformConsts.AbpIdentity.User.AdminRocketUsernameDefaultValue);
|
||||||
|
adminUser.SetPhoneNumber(PlatformConsts.AbpIdentity.User.AdminPhoneNumberDefaultValue, true);
|
||||||
|
|
||||||
|
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
||||||
|
result.CreatedAdminUser = true;
|
||||||
|
|
||||||
|
(await UserManager.AddToRoleAsync(adminUser, PlatformConsts.AbpIdentity.User.AdminRoleName)).CheckErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grant all permission kısmı Abp tarafından otomatik çalıştırılıyor.
|
||||||
|
// Ayrıca bende çalıştırınca hata veriyor.
|
||||||
|
// Hem DbMigrator hem de burada IdentityDataSeeder var.
|
||||||
|
// Aynı Assembly'de birden fazla IdentityDataSeeder olabilir
|
||||||
|
// DbMigrator çalışınca kendi IdentityDataSeeder'ını çalıştırıyor.
|
||||||
|
// Tenant seed edilince bu IdentityDataSeeder çalışıyor.
|
||||||
|
// See: Volo.Abp.PermissionManagement.PermissionDataSeedContributor
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Kurs.Platform.Abouts;
|
|
||||||
using Kurs.Platform.Contacts;
|
|
||||||
using Kurs.Platform.Entities;
|
using Kurs.Platform.Entities;
|
||||||
|
using Kurs.Platform.Public;
|
||||||
|
|
||||||
namespace Kurs.Platform.Seeds;
|
namespace Kurs.Platform.Seeds;
|
||||||
|
|
||||||
Loading…
Reference in a new issue