feat : add permissions , add new entities for users
parent
27a6b10edf
commit
9a9bbcad5d
|
@ -19,15 +19,15 @@ public class BlogCategoryController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission,ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,15 +19,15 @@ public class BlogController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,15 +20,15 @@ public class BrandController : ICarterModule
|
|||
|
||||
group.MapPost("", Post)
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBrands));
|
||||
|
||||
group.MapPut("", Put)
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBrands));
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBrands));
|
||||
}
|
||||
|
||||
// GET:Get All Entity
|
||||
|
|
|
@ -6,7 +6,7 @@ public class DashboardController : ICarterModule
|
|||
{
|
||||
var group = app.NewVersionedApi("Dashboard")
|
||||
.MapGroup("api/dashboard")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard));
|
||||
|
||||
group.MapGet("home", GetHomeDashboardAsync)
|
||||
.WithDisplayName("Get Home Dashboard")
|
||||
|
|
|
@ -10,10 +10,12 @@ public class DiscountController : ICarterModule
|
|||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetAllDiscounts")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard,ApplicationPermission.ViewDiscounts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetDiscount")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard, ApplicationPermission.ViewDiscounts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("corporate", GetCorporateDiscountAsync)
|
||||
|
@ -21,13 +23,16 @@ public class DiscountController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.HasApiVersion(1.0);
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard));
|
||||
|
||||
group.MapPut("", Put)
|
||||
.HasApiVersion(1.0);
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard));
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.HasApiVersion(1.0);
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard));
|
||||
}
|
||||
|
||||
private async Task<IResult> GetCorporateDiscountAsync([FromQuery] Guid? corporateUserId, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
|
|
|
@ -12,10 +12,12 @@ public class FileController : ICarterModule
|
|||
|
||||
group.MapGet("", GetFilesAsync)
|
||||
.WithDisplayName("GetFilesAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageFiles, ApplicationPermission.ViewFiles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", UploadFileAsync)
|
||||
.WithDisplayName("UploadFileAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageFiles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public class NewsletterMemberController : ICarterModule
|
|||
group.MapGet("", GetAllMembersAsync)
|
||||
.WithDisplayName("Get All Members")
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewNewsletterMembers));
|
||||
|
||||
group.MapPost("", PostMemberAsync)
|
||||
.WithDisplayName("Post Member")
|
||||
|
|
|
@ -8,7 +8,7 @@ public class OrderBagController : ICarterModule
|
|||
{
|
||||
var group = app.NewVersionedApi("OrderBag")
|
||||
.MapGroup("api/order/bag")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.CreateOrder));
|
||||
|
||||
group.MapGet("", GetUserCurrentOrderBagAsync)
|
||||
.WithDisplayName("GetUserCurrentOrderBag")
|
||||
|
|
|
@ -11,22 +11,27 @@ public class OrderController : ICarterModule
|
|||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetAllOrders")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllOrders , ApplicationPermission.ManageOrders))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetOneOrder")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllOrders, ApplicationPermission.ManageOrders))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("{id}/confirm", ConfirmOrderStepAsync)
|
||||
.WithDisplayName("ConfirmOrderStep")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageOrders))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", DeleteAsync)
|
||||
.WithDisplayName("DeleteOneOrder")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageOrders))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}/invoice", GetOrderInvoiceAsync)
|
||||
.WithDisplayName("GetOrderInvoice")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageOrders))
|
||||
.AllowAnonymous()
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
|
|
@ -10,18 +10,18 @@ public class PageController : ICarterModule
|
|||
group.MapGet("", GetPagesAsync)
|
||||
.WithDisplayName("Get Pages")
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewPages, ApplicationPermission.ManagePages));
|
||||
|
||||
|
||||
group.MapGet("{id}", GetPageByIdAsync)
|
||||
.WithDisplayName("Get Page")
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewPages, ApplicationPermission.ManagePages));
|
||||
|
||||
group.MapGet("slug/{pageSlug}", GetPageAsync)
|
||||
.WithDisplayName("Get Page")
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewPages, ApplicationPermission.ManagePages));
|
||||
|
||||
group.MapGet("type/{type}", GetPageByTypeAsync)
|
||||
.WithDisplayName("Get Page")
|
||||
|
@ -30,7 +30,7 @@ public class PageController : ICarterModule
|
|||
group.MapPost("", PostPageAsync)
|
||||
.WithDisplayName("Post Page")
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManagePages));
|
||||
}
|
||||
public async Task<IResult> GetPagesAsync(Guid id, [FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ public class PaymentController : ICarterModule
|
|||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetPayments")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewPayments))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
//group.MapGet("{id}", GetAsync)
|
||||
|
|
|
@ -17,15 +17,15 @@ public class ProductCategoryController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission,ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,19 +19,19 @@ public class ProductController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("{productId}", ChangeDisplayedAsync)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageProducts))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,27 +5,31 @@ public class ProductReviewController : ICarterModule
|
|||
public void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("ProductReview")
|
||||
.MapGroup("product/review")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.MapGroup("product/review");
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetOneAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllReviews,ApplicationPermission.ManageReview))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetAllAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllReviews, ApplicationPermission.ManageReview))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", PostAsync)
|
||||
.WithDisplayName("PostReview")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageReview, ApplicationPermission.AddReview))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("confirm/{id}", ConfirmAsync)
|
||||
.WithDisplayName("ConfirmAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ConfirmReview, ApplicationPermission.ManageReview))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", DeleteAsync)
|
||||
.WithDisplayName("DeleteAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageReview))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,28 +8,33 @@ public class RoleController : ICarterModule
|
|||
{
|
||||
|
||||
var group = app.NewVersionedApi("Roles")
|
||||
.MapGroup($"api/user/role")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.MapGroup($"api/user/role");
|
||||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetAllRoles")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewRoles, ApplicationPermission.ManageRoles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("permission", GetAllPermissions)
|
||||
.WithDisplayName("GetAllPermissions")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewRoles, ApplicationPermission.ManageRoles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetRole")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewRoles, ApplicationPermission.ManageRoles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageRoles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageRoles))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageRoles))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ public class ScraperController : ICarterModule
|
|||
{
|
||||
var group = app.NewVersionedApi("Scraper")
|
||||
.MapGroup("api/scraper")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission,ApplicationPermission.ManageScraper));
|
||||
|
||||
group.MapGet("digi", GetDigiProductsAsync)
|
||||
.WithDisplayName("GetDigiProducts")
|
||||
|
|
|
@ -11,12 +11,12 @@ public class SettingController : ICarterModule
|
|||
|
||||
group.MapGet("{settingName}", GetSettingAsync)
|
||||
.WithDisplayName("GetSetting")
|
||||
.RequireAuthorization(builder=>builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder=>builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewSettings,ApplicationPermission.ManageSettings))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("{settingName}", PostSettingAsync)
|
||||
.WithDisplayName("PostSettingAsync")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageSettings))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,19 +14,19 @@ public class ShippingController : ICarterModule
|
|||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetShipping")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewShipping, ApplicationPermission.ManageShipping))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageShipping))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageShipping))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageShipping))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,19 +5,21 @@ public class UserAddressController : ICarterModule
|
|||
public void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("UserAddress")
|
||||
.MapGroup("api/user/address")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.MapGroup("api/user/address");
|
||||
|
||||
group.MapGet("", GetAddressesAsync)
|
||||
.WithDisplayName("Get Addresses")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", PostAddressesAsync)
|
||||
.WithDisplayName("Post Addresses")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", DeleteAddressesAsync)
|
||||
.WithDisplayName("Delete Address")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,40 +12,48 @@ public class UserController : ICarterModule
|
|||
{
|
||||
|
||||
var group = app.NewVersionedApi("Users")
|
||||
.MapGroup($"api/user")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
|
||||
.MapGroup($"api/user");
|
||||
|
||||
group.MapGet("info", GetUserInfoAsync)
|
||||
.WithDisplayName("GetUserInfo")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetAllUsers")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewUsers, ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetUser")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewUsers, ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("/order", GetUserOrdersAsync)
|
||||
.WithDisplayName("GetUserOrders")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewMineOrders))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}/order", GetUserOrdersByIdAsync)
|
||||
.WithDisplayName("GetUserOrders")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllOrders))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("/changelog", GetChangeLogAsync)
|
||||
.WithDisplayName("GetChangeLog")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageDashboard))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
<Using Include="NetinaShop.Domain.Entities.ProductCategories" />
|
||||
<Using Include="NetinaShop.Domain.Entities.Users" />
|
||||
<Using Include="NetinaShop.Domain.Mappers" />
|
||||
<Using Include="NetinaShop.Domain.Models.Claims" />
|
||||
<Using Include="NetinaShop.Domain.Models.Settings" />
|
||||
<Using Include="NetinaShop.Infrastructure" />
|
||||
<Using Include="NetinaShop.Infrastructure.Models" />
|
||||
|
|
|
@ -10,7 +10,7 @@ public class AccountService : IAccountService
|
|||
private readonly ICurrentUserService _currentUserService;
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ISmsService _smsService;
|
||||
private readonly IManagerUserService _managerUserService;
|
||||
private readonly IUserService _managerUserService;
|
||||
|
||||
public AccountService(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
|
@ -19,7 +19,7 @@ public class AccountService : IAccountService
|
|||
ICurrentUserService currentUserService,
|
||||
IRepositoryWrapper repositoryWrapper,
|
||||
ISmsService smsService,
|
||||
IManagerUserService managerUserService)
|
||||
IUserService managerUserService)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_userSignInManager = userSignInManager;
|
||||
|
@ -69,7 +69,7 @@ public class AccountService : IAccountService
|
|||
throw new AppException("شماره تلفن ارسالی اشتباه است");
|
||||
var user = await _userManager.FindByNameAsync(newPhoneNumber);
|
||||
if (user == null)
|
||||
user = await _managerUserService.CreateManagerAsync(phoneNumber);
|
||||
user = await _managerUserService.CreateUserAsync(phoneNumber);
|
||||
|
||||
var token = await _userManager.GenerateTwoFactorTokenAsync(user, "Phone");
|
||||
await _smsService.SendVerifyCodeAsync(newPhoneNumber, token);
|
||||
|
@ -138,6 +138,14 @@ public class AccountService : IAccountService
|
|||
var roleResult = await _userManager.AddToRoleAsync(user, "Customer");
|
||||
if (!roleResult.Succeeded)
|
||||
throw new AppException(string.Join('|', roleResult.Errors.Select(e => e.Description)));
|
||||
|
||||
_repositoryWrapper.SetRepository<Customer>()
|
||||
.Add(new Customer
|
||||
{
|
||||
UserId = user.Id,
|
||||
});
|
||||
await _repositoryWrapper.SaveChangesAsync(default);
|
||||
|
||||
return await CompleteLogin(user, cancellationToken);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler<CalculateOrd
|
|||
{
|
||||
var discountedUserOrder = await _repositoryWrapper.SetRepository<Order>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(f => f.UserId == userId && f.DiscountCode == discount.Code, cancellationToken);
|
||||
.FirstOrDefaultAsync(f => f.CustomerId == userId && f.DiscountCode == discount.Code, cancellationToken);
|
||||
if (discountedUserOrder != null)
|
||||
throw new AppException("شما یک بار از این کد تخفیف استفاده کرده اید", ApiResultStatusCode.BadRequest);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler<CalculateOrd
|
|||
{
|
||||
var userOrderCount = await _repositoryWrapper.SetRepository<Order>()
|
||||
.TableNoTracking
|
||||
.CountAsync(f => f.UserId == firstPurchaseUserId && f.DiscountCode == discount.Code, cancellationToken);
|
||||
.CountAsync(f => f.CustomerId == firstPurchaseUserId && f.DiscountCode == discount.Code, cancellationToken);
|
||||
if (userOrderCount > 0)
|
||||
throw new AppException("شما قبلا خریدی داشته اید و نمیتوانید از تخفیف اولین خرید استفاده کنید", ApiResultStatusCode.BadRequest);
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ public class AddToOrderBagCommandHandler : IRequestHandler<AddToOrderBagCommand,
|
|||
public async Task<OrderSDto> Handle(AddToOrderBagCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new AppException("User id notfound", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id notfound", ApiResultStatusCode.BadRequest);
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id wrong", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id wrong", ApiResultStatusCode.BadRequest);
|
||||
|
||||
var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken);
|
||||
|
||||
|
|
|
@ -15,13 +15,27 @@ public class GetUserOrderBagQueryHandler : IRequestHandler<GetUserOrderBagQuery,
|
|||
public async Task<Order> Handle(GetUserOrderBagQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new AppException("User id notfound", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id notfound", ApiResultStatusCode.BadRequest);
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id wrong",ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id wrong",ApiResultStatusCode.BadRequest);
|
||||
|
||||
var customer = await _repositoryWrapper.SetRepository<Customer>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(c => c.UserId == userId, cancellationToken);
|
||||
if (customer == null)
|
||||
{
|
||||
customer = new Customer
|
||||
{
|
||||
UserId = userId
|
||||
};
|
||||
_repositoryWrapper.SetRepository<Customer>()
|
||||
.Add(customer);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
|
||||
var order = await _repositoryWrapper.SetRepository<Order>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(o => o.UserId == userId && o.OrderStatus == OrderStatus.OrderBag,cancellationToken);
|
||||
.FirstOrDefaultAsync(o => o.CustomerId == customer.Id && o.OrderStatus == OrderStatus.OrderBag,cancellationToken);
|
||||
|
||||
if (order == null)
|
||||
order = await _mediator.Send(new CreateBaseOrderCommand(userId),cancellationToken);
|
||||
|
|
|
@ -15,9 +15,9 @@ public class RemoveFromOrderBagCommandHandler : IRequestHandler<RemoveFromOrderB
|
|||
public async Task<OrderSDto> Handle(RemoveFromOrderBagCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new AppException("User id notfound", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id notfound", ApiResultStatusCode.BadRequest);
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id wrong", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id wrong", ApiResultStatusCode.BadRequest);
|
||||
|
||||
var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken);
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ public class SubmitOrderBagCommandHandler : IRequestHandler<SubmitOrderBagComman
|
|||
public async Task<OrderSDto> Handle(SubmitOrderBagCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new AppException("User id notfound", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id notfound", ApiResultStatusCode.BadRequest);
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id wrong", ApiResultStatusCode.BadRequest);
|
||||
throw new AppException("Customer id wrong", ApiResultStatusCode.BadRequest);
|
||||
|
||||
var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class SubmitOrderPaymentCommandHandler : IRequestHandler<SubmitOrderPayme
|
|||
.FirstOrDefaultAsync(cancellationToken);
|
||||
if (orderSDto == null)
|
||||
throw new AppException("Order not found", ApiResultStatusCode.NotFound);
|
||||
response.PaymentUrl = await _paymentService.GetPaymentLinkAsync(orderSDto.TotalPrice, orderSDto.FactorCode, orderSDto.Id, orderSDto.UserId, orderSDto.UserPhoneNumber, orderSDto.UserFullName, cancellationToken);
|
||||
response.PaymentUrl = await _paymentService.GetPaymentLinkAsync(orderSDto.TotalPrice, orderSDto.FactorCode, orderSDto.Id, orderSDto.CustomerId, orderSDto.CustomerPhoneNumber, orderSDto.CustomerFullName, cancellationToken);
|
||||
}
|
||||
}
|
||||
else if (request.PaymentMethod == OrderPaymentMethod.PayOnDoor)
|
||||
|
@ -58,7 +58,7 @@ public class SubmitOrderPaymentCommandHandler : IRequestHandler<SubmitOrderPayme
|
|||
await _mediator.Send(new CreateOrUpdatePaymentCommand(null,order.FactorCode, order.TotalPrice,
|
||||
$"پرداخت نقدی سفارش {order.FactorCode}", string.Empty, string.Empty, string.Empty,
|
||||
PaymentType.PayOnDoor, PaymentStatus.Paid, order.Id
|
||||
, order.UserId), cancellationToken);
|
||||
, order.CustomerId), cancellationToken);
|
||||
}
|
||||
else if (request.PaymentMethod == OrderPaymentMethod.CardTransfer)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ public class SubmitOrderPaymentCommandHandler : IRequestHandler<SubmitOrderPayme
|
|||
await _mediator.Send(new CreateOrUpdatePaymentCommand(null,order.FactorCode, order.TotalPrice,
|
||||
$"پرداخت نقدی سفارش {order.FactorCode}", string.Empty, string.Empty, string.Empty,
|
||||
PaymentType.CardTransfer, PaymentStatus.Paid, order.Id
|
||||
, order.UserId), cancellationToken);
|
||||
, order.CustomerId), cancellationToken);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
|
|
@ -58,13 +58,13 @@ public class UserService : IUserService
|
|||
|
||||
if (phoneNumber == null || phoneNumber.IsNullOrEmpty())
|
||||
users = await _userManager.Users
|
||||
.Where(u=>u.UserName!= "09214802813")
|
||||
.Where(u => u.UserName != "09214802813")
|
||||
.Skip(page * 15).Take(15)
|
||||
.Select(ApplicationUserMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
else
|
||||
users = await _userManager.Users
|
||||
.Where(a => a.PhoneNumber == phoneNumber && a.UserName!= "09214802813")
|
||||
.Where(a => a.PhoneNumber == phoneNumber && a.UserName != "09214802813")
|
||||
.Skip(page * 15).Take(15)
|
||||
.Select(ApplicationUserMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
@ -79,7 +79,7 @@ public class UserService : IUserService
|
|||
}
|
||||
}
|
||||
|
||||
var returnUser = users.Where(r=> r.RoleName.Trim() != "مشتری" && r.FullName.Trim() != "همه کاره سیستم").ToList();
|
||||
var returnUser = users.Where(r => r.FullName.Trim() != "همه کاره سیستم").ToList();
|
||||
return returnUser;
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,26 @@ public class UserService : IUserService
|
|||
await _userManager.AddToRoleAsync(user, role.Name);
|
||||
}
|
||||
}
|
||||
|
||||
var customer = await _repositoryWrapper.SetRepository<Customer>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(c => c.UserId == user.Id, cancellationToken);
|
||||
if (customer != null)
|
||||
{
|
||||
_repositoryWrapper.SetRepository<Customer>()
|
||||
.Add(new Customer
|
||||
{
|
||||
UserId = user.Id
|
||||
});
|
||||
await _repositoryWrapper.SaveChangesAsync(default);
|
||||
}
|
||||
|
||||
_repositoryWrapper.SetRepository<Manager>()
|
||||
.Add(new Manager
|
||||
{
|
||||
UserId = user.Id
|
||||
});
|
||||
await _repositoryWrapper.SaveChangesAsync(default);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
@ -250,6 +270,28 @@ public class UserService : IUserService
|
|||
var removeResult = await _userManager.DeleteAsync(user);
|
||||
if (!removeResult.Succeeded)
|
||||
throw new AppException(string.Join('|', removeResult.Errors.Select(e => e.Description)));
|
||||
|
||||
var customer = await _repositoryWrapper.SetRepository<Customer>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(c => c.UserId == userId, cancellationToken);
|
||||
if (customer != null)
|
||||
{
|
||||
|
||||
_repositoryWrapper.SetRepository<Customer>()
|
||||
.Delete(customer);
|
||||
await _repositoryWrapper.SaveChangesAsync(default);
|
||||
}
|
||||
var manager = await _repositoryWrapper.SetRepository<Manager>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(c => c.UserId == userId, cancellationToken);
|
||||
if (manager != null)
|
||||
{
|
||||
|
||||
_repositoryWrapper.SetRepository<Manager>()
|
||||
.Delete(manager);
|
||||
await _repositoryWrapper.SaveChangesAsync(default);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -284,7 +326,7 @@ public class UserService : IUserService
|
|||
public async Task<List<ApplicationRole>> GetRolesAsync(int page = 0, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var roles = await _roleManager.Roles
|
||||
.Where(r=>r.Name != "RootAdmin")
|
||||
.Where(r => r.Name != "RootAdmin")
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
@ -294,7 +336,7 @@ public class UserService : IUserService
|
|||
public async Task<List<ApplicationRole>> GetRolesAsync(int? page, string? roleName, CancellationToken cancellationToken = default)
|
||||
{
|
||||
IQueryable<ApplicationRole> roles;
|
||||
if (roleName!=null)
|
||||
if (roleName != null)
|
||||
roles = _roleManager.Roles.Where(r => r.Name != "RootAdmin" && r.Name != "Customer" && r.PersianName.Trim().ToLower().Contains(roleName));
|
||||
else
|
||||
roles = _roleManager.Roles.Where(r => r.Name != "RootAdmin" && r.Name != "Customer");
|
||||
|
@ -360,7 +402,7 @@ public class UserService : IUserService
|
|||
var roleClaims = (await _roleManager.GetClaimsAsync(applicationRole)).Where(c => c.Type == CustomClaimType.Permission).ToList();
|
||||
foreach (var roleClaim in roleClaims.ToList())
|
||||
{
|
||||
var removeResult = await _roleManager.RemoveClaimAsync(applicationRole,roleClaim);
|
||||
var removeResult = await _roleManager.RemoveClaimAsync(applicationRole, roleClaim);
|
||||
if (!removeResult.Succeeded)
|
||||
throw new AppException(string.Join(" | ", removeResult.Errors.Select(e => e.Description)));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
public sealed record GetOrderLDtoQuery(Guid Id) : IRequest<OrderLDto>;
|
||||
|
||||
public sealed record GetUserOrdersQuery(Guid UserId = default) : IRequest<List<OrderSDto>>;
|
||||
public sealed record GetUserOrdersQuery(Guid CustomerId = default) : IRequest<List<OrderSDto>>;
|
||||
public sealed record GetOrderQuery(Guid Id) : IRequest<Order>;
|
||||
public sealed record GetOrdersQuery(OrderQueryDateFilter? DateFilter, OrderStatus? OrderStatus,long? SelectedDate, int Page = 0) : IRequest<List<OrderSDto>>;
|
|
@ -18,7 +18,7 @@ public class OrderSDto : BaseDto<OrderSDto, Order>
|
|||
public DateTime OrderAt { get; set; }
|
||||
public int PreparingMinute { get; set; }
|
||||
public string DiscountCode { get; set; } = string.Empty;
|
||||
public string UserFullName { get; set; } = string.Empty;
|
||||
public string UserPhoneNumber { get; set; } = string.Empty;
|
||||
public Guid UserId { get; set; }
|
||||
public string CustomerFullName { get; set; } = string.Empty;
|
||||
public string CustomerPhoneNumber { get; set; } = string.Empty;
|
||||
public Guid CustomerId { get; set; }
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class PaymentSDto : BaseDto<PaymentSDto,Payment>
|
|||
public PaymentStatus Status { get; set; }
|
||||
|
||||
public Guid OrderId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string UserFullName { get; set; } = string.Empty;
|
||||
public string UserPhoneNumber { get; set; } = string.Empty;
|
||||
public Guid CustomerId { get; set; }
|
||||
public string CustomerFullName { get; set; } = string.Empty;
|
||||
public string CustomerPhoneNumber { get; set; } = string.Empty;
|
||||
}
|
|
@ -11,7 +11,7 @@ public partial class Payment : ApiEntity
|
|||
{
|
||||
|
||||
}
|
||||
public Payment(string factorNumber, double amount, string description, string transactionCode, string cardPan, string authority, PaymentType type, PaymentStatus status, Guid orderId, Guid userId)
|
||||
public Payment(string factorNumber, double amount, string description, string transactionCode, string cardPan, string authority, PaymentType type, PaymentStatus status, Guid orderId, Guid customerId)
|
||||
{
|
||||
FactorNumber = factorNumber;
|
||||
Amount = amount;
|
||||
|
@ -22,7 +22,7 @@ public partial class Payment : ApiEntity
|
|||
Type = type;
|
||||
Status = status;
|
||||
OrderId = orderId;
|
||||
UserId = userId;
|
||||
CustomerId = customerId;
|
||||
}
|
||||
|
||||
public string FactorNumber { get; internal set; } = string.Empty;
|
||||
|
@ -36,6 +36,6 @@ public partial class Payment : ApiEntity
|
|||
|
||||
public Guid OrderId { get; internal set; }
|
||||
public Order? Order { get; internal set; }
|
||||
public Guid UserId { get; internal set; }
|
||||
public ApplicationUser? User { get; internal set; }
|
||||
public Guid CustomerId { get; internal set; }
|
||||
public Customer? Customer { get; internal set; }
|
||||
}
|
|
@ -28,7 +28,7 @@ public partial class Order : ApiEntity
|
|||
DateTime orderAt,
|
||||
int preparingMinute,
|
||||
string discountCode,
|
||||
Guid userId,
|
||||
Guid customerId,
|
||||
OrderPaymentMethod paymentMethod)
|
||||
{
|
||||
FactorCode = factorCode;
|
||||
|
@ -45,7 +45,7 @@ public partial class Order : ApiEntity
|
|||
OrderAt = orderAt;
|
||||
PreparingMinute = preparingMinute;
|
||||
DiscountCode = discountCode;
|
||||
UserId = userId;
|
||||
CustomerId = customerId;
|
||||
PaymentMethod = paymentMethod;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ public partial class Order : ApiEntity
|
|||
public int PreparingMinute { get; internal set; }
|
||||
public string DiscountCode { get; internal set; } = string.Empty;
|
||||
|
||||
public Guid UserId { get; internal set; }
|
||||
public Customer? User { get; internal set; }
|
||||
public Guid CustomerId { get; internal set; }
|
||||
public Customer? Customer { get; internal set; }
|
||||
|
||||
public OrderDelivery? OrderDelivery { get; set; }
|
||||
|
||||
|
|
|
@ -1,6 +1,83 @@
|
|||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using NetinaShop.Domain.Dtos.SmallDtos;
|
||||
using NetinaShop.Domain.Entities.Users;
|
||||
using NetinaShop.Domain.Enums;
|
||||
|
||||
namespace NetinaShop.Domain.Mappers
|
||||
{
|
||||
public static partial class CustomerMapper
|
||||
{
|
||||
public static Customer AdaptToCustomer(this CustomerSDto p1)
|
||||
{
|
||||
return p1 == null ? null : new Customer()
|
||||
{
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Customer AdaptTo(this CustomerSDto p2, Customer p3)
|
||||
{
|
||||
if (p2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Customer result = p3 ?? new Customer();
|
||||
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static CustomerSDto AdaptToSDto(this Customer p4)
|
||||
{
|
||||
return p4 == null ? null : new CustomerSDto()
|
||||
{
|
||||
PhoneNumber = p4.User != null ? p4.User.PhoneNumber : string.Empty,
|
||||
FirstName = p4.User != null ? p4.User.FirstName : string.Empty,
|
||||
LastName = p4.User != null ? p4.User.LastName : string.Empty,
|
||||
BirthDate = p4.User != null ? p4.User.BirthDate : DateTime.MinValue,
|
||||
Gender = p4.User != null ? p4.User.Gender : Gender.Male,
|
||||
SignUpStatus = p4.User != null ? p4.User.SignUpStatus : SignUpStatus.StartSignOn,
|
||||
NationalId = p4.User != null ? p4.User.NationalId : string.Empty,
|
||||
Email = p4.User != null ? p4.User.Email : string.Empty,
|
||||
Id = p4.Id,
|
||||
CreatedAt = p4.CreatedAt
|
||||
};
|
||||
}
|
||||
public static CustomerSDto AdaptTo(this Customer p5, CustomerSDto p6)
|
||||
{
|
||||
if (p5 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
CustomerSDto result = p6 ?? new CustomerSDto();
|
||||
|
||||
result.PhoneNumber = p5.User != null ? p5.User.PhoneNumber : string.Empty;
|
||||
result.FirstName = p5.User != null ? p5.User.FirstName : string.Empty;
|
||||
result.LastName = p5.User != null ? p5.User.LastName : string.Empty;
|
||||
result.BirthDate = p5.User != null ? p5.User.BirthDate : DateTime.MinValue;
|
||||
result.Gender = p5.User != null ? p5.User.Gender : Gender.Male;
|
||||
result.SignUpStatus = p5.User != null ? p5.User.SignUpStatus : SignUpStatus.StartSignOn;
|
||||
result.NationalId = p5.User != null ? p5.User.NationalId : string.Empty;
|
||||
result.Email = p5.User != null ? p5.User.Email : string.Empty;
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Customer, CustomerSDto>> ProjectToSDto => p7 => new CustomerSDto()
|
||||
{
|
||||
PhoneNumber = p7.User != null ? p7.User.PhoneNumber : string.Empty,
|
||||
FirstName = p7.User != null ? p7.User.FirstName : string.Empty,
|
||||
LastName = p7.User != null ? p7.User.LastName : string.Empty,
|
||||
BirthDate = p7.User != null ? p7.User.BirthDate : DateTime.MinValue,
|
||||
Gender = p7.User != null ? p7.User.Gender : Gender.Male,
|
||||
SignUpStatus = p7.User != null ? p7.User.SignUpStatus : SignUpStatus.StartSignOn,
|
||||
NationalId = p7.User != null ? p7.User.NationalId : string.Empty,
|
||||
Email = p7.User != null ? p7.User.Email : string.Empty,
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Linq.Expressions;
|
||||
using NetinaShop.Domain.Dtos.SmallDtos;
|
||||
using NetinaShop.Domain.Entities.Users;
|
||||
using NetinaShop.Domain.Enums;
|
||||
|
||||
namespace NetinaShop.Domain.Mappers
|
||||
{
|
||||
|
@ -12,15 +13,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
return p1 == null ? null : new Manager()
|
||||
{
|
||||
LatestVersionUsed = p1.LatestVersionUsed,
|
||||
FirstName = p1.FirstName,
|
||||
LastName = p1.LastName,
|
||||
NationalId = p1.NationalId,
|
||||
BirthDate = p1.BirthDate,
|
||||
Gender = p1.Gender,
|
||||
SignUpStatus = p1.SignUpStatus,
|
||||
Id = p1.Id,
|
||||
Email = p1.Email,
|
||||
PhoneNumber = p1.PhoneNumber
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Manager AdaptTo(this ManagerSDto p2, Manager p3)
|
||||
|
@ -32,15 +26,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Manager result = p3 ?? new Manager();
|
||||
|
||||
result.LatestVersionUsed = p2.LatestVersionUsed;
|
||||
result.FirstName = p2.FirstName;
|
||||
result.LastName = p2.LastName;
|
||||
result.NationalId = p2.NationalId;
|
||||
result.BirthDate = p2.BirthDate;
|
||||
result.Gender = p2.Gender;
|
||||
result.SignUpStatus = p2.SignUpStatus;
|
||||
result.Id = p2.Id;
|
||||
result.Email = p2.Email;
|
||||
result.PhoneNumber = p2.PhoneNumber;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -48,16 +35,17 @@ namespace NetinaShop.Domain.Mappers
|
|||
{
|
||||
return p4 == null ? null : new ManagerSDto()
|
||||
{
|
||||
PhoneNumber = p4.PhoneNumber,
|
||||
FirstName = p4.FirstName,
|
||||
LastName = p4.LastName,
|
||||
BirthDate = p4.BirthDate,
|
||||
Gender = p4.Gender,
|
||||
SignUpStatus = p4.SignUpStatus,
|
||||
NationalId = p4.NationalId,
|
||||
Email = p4.Email,
|
||||
PhoneNumber = p4.User != null ? p4.User.PhoneNumber : string.Empty,
|
||||
FirstName = p4.User != null ? p4.User.FirstName : string.Empty,
|
||||
LastName = p4.User != null ? p4.User.LastName : string.Empty,
|
||||
BirthDate = p4.User != null ? p4.User.BirthDate : DateTime.MinValue,
|
||||
Gender = p4.User != null ? p4.User.Gender : Gender.Male,
|
||||
SignUpStatus = p4.User != null ? p4.User.SignUpStatus : SignUpStatus.StartSignOn,
|
||||
NationalId = p4.User != null ? p4.User.NationalId : string.Empty,
|
||||
Email = p4.User != null ? p4.User.Email : string.Empty,
|
||||
LatestVersionUsed = p4.LatestVersionUsed,
|
||||
Id = p4.Id
|
||||
Id = p4.Id,
|
||||
CreatedAt = p4.CreatedAt
|
||||
};
|
||||
}
|
||||
public static ManagerSDto AdaptTo(this Manager p5, ManagerSDto p6)
|
||||
|
@ -68,31 +56,33 @@ namespace NetinaShop.Domain.Mappers
|
|||
}
|
||||
ManagerSDto result = p6 ?? new ManagerSDto();
|
||||
|
||||
result.PhoneNumber = p5.PhoneNumber;
|
||||
result.FirstName = p5.FirstName;
|
||||
result.LastName = p5.LastName;
|
||||
result.BirthDate = p5.BirthDate;
|
||||
result.Gender = p5.Gender;
|
||||
result.SignUpStatus = p5.SignUpStatus;
|
||||
result.NationalId = p5.NationalId;
|
||||
result.Email = p5.Email;
|
||||
result.PhoneNumber = p5.User != null ? p5.User.PhoneNumber : string.Empty;
|
||||
result.FirstName = p5.User != null ? p5.User.FirstName : string.Empty;
|
||||
result.LastName = p5.User != null ? p5.User.LastName : string.Empty;
|
||||
result.BirthDate = p5.User != null ? p5.User.BirthDate : DateTime.MinValue;
|
||||
result.Gender = p5.User != null ? p5.User.Gender : Gender.Male;
|
||||
result.SignUpStatus = p5.User != null ? p5.User.SignUpStatus : SignUpStatus.StartSignOn;
|
||||
result.NationalId = p5.User != null ? p5.User.NationalId : string.Empty;
|
||||
result.Email = p5.User != null ? p5.User.Email : string.Empty;
|
||||
result.LatestVersionUsed = p5.LatestVersionUsed;
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Manager, ManagerSDto>> ProjectToSDto => p7 => new ManagerSDto()
|
||||
{
|
||||
PhoneNumber = p7.PhoneNumber,
|
||||
FirstName = p7.FirstName,
|
||||
LastName = p7.LastName,
|
||||
BirthDate = p7.BirthDate,
|
||||
Gender = p7.Gender,
|
||||
SignUpStatus = p7.SignUpStatus,
|
||||
NationalId = p7.NationalId,
|
||||
Email = p7.Email,
|
||||
PhoneNumber = p7.User != null ? p7.User.PhoneNumber : string.Empty,
|
||||
FirstName = p7.User != null ? p7.User.FirstName : string.Empty,
|
||||
LastName = p7.User != null ? p7.User.LastName : string.Empty,
|
||||
BirthDate = p7.User != null ? p7.User.BirthDate : DateTime.MinValue,
|
||||
Gender = p7.User != null ? p7.User.Gender : Gender.Male,
|
||||
SignUpStatus = p7.User != null ? p7.User.SignUpStatus : SignUpStatus.StartSignOn,
|
||||
NationalId = p7.User != null ? p7.User.NationalId : string.Empty,
|
||||
Email = p7.User != null ? p7.User.Email : string.Empty,
|
||||
LatestVersionUsed = p7.LatestVersionUsed,
|
||||
Id = p7.Id
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,6 +1,93 @@
|
|||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using NetinaShop.Domain.Dtos.SmallDtos;
|
||||
using NetinaShop.Domain.Entities.Users;
|
||||
using NetinaShop.Domain.Enums;
|
||||
|
||||
namespace NetinaShop.Domain.Mappers
|
||||
{
|
||||
public static partial class MarketerMapper
|
||||
{
|
||||
public static Marketer AdaptToMarketer(this MarketerSDto p1)
|
||||
{
|
||||
return p1 == null ? null : new Marketer()
|
||||
{
|
||||
FatherName = p1.FatherName,
|
||||
Shaba = p1.Shaba,
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Marketer AdaptTo(this MarketerSDto p2, Marketer p3)
|
||||
{
|
||||
if (p2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Marketer result = p3 ?? new Marketer();
|
||||
|
||||
result.FatherName = p2.FatherName;
|
||||
result.Shaba = p2.Shaba;
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static MarketerSDto AdaptToSDto(this Marketer p4)
|
||||
{
|
||||
return p4 == null ? null : new MarketerSDto()
|
||||
{
|
||||
PhoneNumber = p4.User != null ? p4.User.PhoneNumber : string.Empty,
|
||||
FirstName = p4.User != null ? p4.User.FirstName : string.Empty,
|
||||
LastName = p4.User != null ? p4.User.LastName : string.Empty,
|
||||
BirthDate = p4.User != null ? p4.User.BirthDate : DateTime.MinValue,
|
||||
Gender = p4.User != null ? p4.User.Gender : Gender.Male,
|
||||
SignUpStatus = p4.User != null ? p4.User.SignUpStatus : SignUpStatus.StartSignOn,
|
||||
NationalId = p4.User != null ? p4.User.NationalId : string.Empty,
|
||||
Email = p4.User != null ? p4.User.Email : string.Empty,
|
||||
FatherName = p4.FatherName,
|
||||
Shaba = p4.Shaba,
|
||||
Id = p4.Id,
|
||||
CreatedAt = p4.CreatedAt
|
||||
};
|
||||
}
|
||||
public static MarketerSDto AdaptTo(this Marketer p5, MarketerSDto p6)
|
||||
{
|
||||
if (p5 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
MarketerSDto result = p6 ?? new MarketerSDto();
|
||||
|
||||
result.PhoneNumber = p5.User != null ? p5.User.PhoneNumber : string.Empty;
|
||||
result.FirstName = p5.User != null ? p5.User.FirstName : string.Empty;
|
||||
result.LastName = p5.User != null ? p5.User.LastName : string.Empty;
|
||||
result.BirthDate = p5.User != null ? p5.User.BirthDate : DateTime.MinValue;
|
||||
result.Gender = p5.User != null ? p5.User.Gender : Gender.Male;
|
||||
result.SignUpStatus = p5.User != null ? p5.User.SignUpStatus : SignUpStatus.StartSignOn;
|
||||
result.NationalId = p5.User != null ? p5.User.NationalId : string.Empty;
|
||||
result.Email = p5.User != null ? p5.User.Email : string.Empty;
|
||||
result.FatherName = p5.FatherName;
|
||||
result.Shaba = p5.Shaba;
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Marketer, MarketerSDto>> ProjectToSDto => p7 => new MarketerSDto()
|
||||
{
|
||||
PhoneNumber = p7.User != null ? p7.User.PhoneNumber : string.Empty,
|
||||
FirstName = p7.User != null ? p7.User.FirstName : string.Empty,
|
||||
LastName = p7.User != null ? p7.User.LastName : string.Empty,
|
||||
BirthDate = p7.User != null ? p7.User.BirthDate : DateTime.MinValue,
|
||||
Gender = p7.User != null ? p7.User.Gender : Gender.Male,
|
||||
SignUpStatus = p7.User != null ? p7.User.SignUpStatus : SignUpStatus.StartSignOn,
|
||||
NationalId = p7.User != null ? p7.User.NationalId : string.Empty,
|
||||
Email = p7.User != null ? p7.User.Email : string.Empty,
|
||||
FatherName = p7.FatherName,
|
||||
Shaba = p7.Shaba,
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,6 @@ using Mapster.Models;
|
|||
using NetinaShop.Domain.Dtos.SmallDtos;
|
||||
using NetinaShop.Domain.Entities.Accounting;
|
||||
using NetinaShop.Domain.Entities.Orders;
|
||||
using NetinaShop.Domain.Entities.Users;
|
||||
|
||||
namespace NetinaShop.Domain.Mappers
|
||||
{
|
||||
|
@ -24,12 +23,6 @@ namespace NetinaShop.Domain.Mappers
|
|||
Status = p1.Status,
|
||||
OrderId = p1.OrderId,
|
||||
Order = new Order() {Id = p1.OrderId},
|
||||
UserId = p1.UserId,
|
||||
User = new ApplicationUser()
|
||||
{
|
||||
Id = p1.UserId,
|
||||
PhoneNumber = p1.UserPhoneNumber
|
||||
},
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
|
@ -52,74 +45,63 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Status = p2.Status;
|
||||
result.OrderId = p2.OrderId;
|
||||
result.Order = funcMain1(new Never(), result.Order, p2);
|
||||
result.UserId = p2.UserId;
|
||||
result.User = funcMain2(new Never(), result.User, p2);
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static PaymentSDto AdaptToSDto(this Payment p8)
|
||||
public static PaymentSDto AdaptToSDto(this Payment p6)
|
||||
{
|
||||
return p8 == null ? null : new PaymentSDto()
|
||||
return p6 == null ? null : new PaymentSDto()
|
||||
{
|
||||
FactorNumber = p8.FactorNumber,
|
||||
Amount = p8.Amount,
|
||||
Description = p8.Description,
|
||||
TransactionCode = p8.TransactionCode,
|
||||
CardPan = p8.CardPan,
|
||||
Authority = p8.Authority,
|
||||
Type = p8.Type,
|
||||
Status = p8.Status,
|
||||
OrderId = p8.OrderId,
|
||||
UserId = p8.UserId,
|
||||
UserFullName = p8.User != null ? p8.User.FirstName + " " + p8.User.LastName : string.Empty,
|
||||
UserPhoneNumber = p8.User != null ? p8.User.PhoneNumber : string.Empty,
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
FactorNumber = p6.FactorNumber,
|
||||
Amount = p6.Amount,
|
||||
Description = p6.Description,
|
||||
TransactionCode = p6.TransactionCode,
|
||||
CardPan = p6.CardPan,
|
||||
Authority = p6.Authority,
|
||||
Type = p6.Type,
|
||||
Status = p6.Status,
|
||||
OrderId = p6.OrderId,
|
||||
Id = p6.Id,
|
||||
CreatedAt = p6.CreatedAt
|
||||
};
|
||||
}
|
||||
public static PaymentSDto AdaptTo(this Payment p9, PaymentSDto p10)
|
||||
public static PaymentSDto AdaptTo(this Payment p7, PaymentSDto p8)
|
||||
{
|
||||
if (p9 == null)
|
||||
if (p7 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
PaymentSDto result = p10 ?? new PaymentSDto();
|
||||
PaymentSDto result = p8 ?? new PaymentSDto();
|
||||
|
||||
result.FactorNumber = p9.FactorNumber;
|
||||
result.Amount = p9.Amount;
|
||||
result.Description = p9.Description;
|
||||
result.TransactionCode = p9.TransactionCode;
|
||||
result.CardPan = p9.CardPan;
|
||||
result.Authority = p9.Authority;
|
||||
result.Type = p9.Type;
|
||||
result.Status = p9.Status;
|
||||
result.OrderId = p9.OrderId;
|
||||
result.UserId = p9.UserId;
|
||||
result.UserFullName = p9.User != null ? p9.User.FirstName + " " + p9.User.LastName : string.Empty;
|
||||
result.UserPhoneNumber = p9.User != null ? p9.User.PhoneNumber : string.Empty;
|
||||
result.Id = p9.Id;
|
||||
result.CreatedAt = p9.CreatedAt;
|
||||
result.FactorNumber = p7.FactorNumber;
|
||||
result.Amount = p7.Amount;
|
||||
result.Description = p7.Description;
|
||||
result.TransactionCode = p7.TransactionCode;
|
||||
result.CardPan = p7.CardPan;
|
||||
result.Authority = p7.Authority;
|
||||
result.Type = p7.Type;
|
||||
result.Status = p7.Status;
|
||||
result.OrderId = p7.OrderId;
|
||||
result.Id = p7.Id;
|
||||
result.CreatedAt = p7.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Payment, PaymentSDto>> ProjectToSDto => p11 => new PaymentSDto()
|
||||
public static Expression<Func<Payment, PaymentSDto>> ProjectToSDto => p9 => new PaymentSDto()
|
||||
{
|
||||
FactorNumber = p11.FactorNumber,
|
||||
Amount = p11.Amount,
|
||||
Description = p11.Description,
|
||||
TransactionCode = p11.TransactionCode,
|
||||
CardPan = p11.CardPan,
|
||||
Authority = p11.Authority,
|
||||
Type = p11.Type,
|
||||
Status = p11.Status,
|
||||
OrderId = p11.OrderId,
|
||||
UserId = p11.UserId,
|
||||
UserFullName = p11.User != null ? p11.User.FirstName + " " + p11.User.LastName : string.Empty,
|
||||
UserPhoneNumber = p11.User != null ? p11.User.PhoneNumber : string.Empty,
|
||||
Id = p11.Id,
|
||||
CreatedAt = p11.CreatedAt
|
||||
FactorNumber = p9.FactorNumber,
|
||||
Amount = p9.Amount,
|
||||
Description = p9.Description,
|
||||
TransactionCode = p9.TransactionCode,
|
||||
CardPan = p9.CardPan,
|
||||
Authority = p9.Authority,
|
||||
Type = p9.Type,
|
||||
Status = p9.Status,
|
||||
OrderId = p9.OrderId,
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
|
||||
private static Order funcMain1(Never p4, Order p5, PaymentSDto p2)
|
||||
|
@ -130,15 +112,5 @@ namespace NetinaShop.Domain.Mappers
|
|||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static ApplicationUser funcMain2(Never p6, ApplicationUser p7, PaymentSDto p2)
|
||||
{
|
||||
ApplicationUser result = p7 ?? new ApplicationUser();
|
||||
|
||||
result.Id = p2.UserId;
|
||||
result.PhoneNumber = p2.UserPhoneNumber;
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,14 +35,14 @@ public class MapsterRegister : IRegister
|
|||
.TwoWays();
|
||||
|
||||
config.NewConfig<Order, OrderSDto>()
|
||||
.Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty)
|
||||
.Map("UserPhoneNumber", o => o.User != null ? o.User.PhoneNumber : string.Empty)
|
||||
.Map("CustomerFullName", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.FirstName + " " + o.Customer.User.LastName : string.Empty)
|
||||
.Map("CustomerPhoneNumber", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.PhoneNumber : string.Empty)
|
||||
.IgnoreNullValues(false)
|
||||
.TwoWays();
|
||||
|
||||
config.NewConfig<Order, OrderLDto>()
|
||||
.Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty)
|
||||
.Map("UserPhoneNumber", o => o.User != null ? o.User.PhoneNumber : string.Empty)
|
||||
.Map("CustomerFullName", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.FirstName + " " + o.Customer.User.LastName : string.Empty)
|
||||
.Map("CustomerPhoneNumber", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.PhoneNumber : string.Empty)
|
||||
.IgnoreNullValues(false)
|
||||
.TwoWays();
|
||||
|
||||
|
@ -66,8 +66,8 @@ public class MapsterRegister : IRegister
|
|||
.TwoWays();
|
||||
|
||||
config.NewConfig<Payment, PaymentSDto>()
|
||||
.Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty)
|
||||
.Map("UserPhoneNumber", o => o.User != null ? o.User.PhoneNumber : string.Empty)
|
||||
.Map("CustomerFullName", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.FirstName + " " + o.Customer.User.LastName : string.Empty)
|
||||
.Map("CustomerPhoneNumber", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.PhoneNumber : string.Empty)
|
||||
.IgnoreNullValues(false)
|
||||
.TwoWays();
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@ namespace NetinaShop.Domain.Models.Claims;
|
|||
|
||||
public static class ApplicationClaims
|
||||
{
|
||||
public static ClaimDto ManageDashboard { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت داشبورد",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageDashboard,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageBlogs { get; } = new ClaimDto
|
||||
{
|
||||
|
@ -177,9 +183,75 @@ public static class ApplicationClaims
|
|||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewFiles,
|
||||
};
|
||||
public static ClaimDto ViewNewsletterMembers { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده اعضا خبرنامه ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewNewsletterMembers,
|
||||
};
|
||||
public static ClaimDto ManagePages { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت صفحه ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManagePages,
|
||||
};
|
||||
public static ClaimDto ViewPages { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده صفحه ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewPages,
|
||||
};
|
||||
public static ClaimDto ViewPayments { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده پرداخت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewPayments,
|
||||
};
|
||||
|
||||
public static ClaimDto ViewRoles { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده نقش ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewRoles,
|
||||
};
|
||||
public static ClaimDto ManageRoles { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت نقش ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageRoles,
|
||||
};
|
||||
public static ClaimDto ManageScraper { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت خزنده ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageScraper,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageSettings { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت تنظیمات ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageSettings,
|
||||
};
|
||||
public static ClaimDto ViewSettings { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده تنظیمات ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewSettings,
|
||||
};
|
||||
|
||||
public static List<ClaimDto> AllClaimDtos = new List<ClaimDto>
|
||||
{
|
||||
ViewSettings,
|
||||
ManageSettings,
|
||||
ManageScraper,
|
||||
ViewRoles,
|
||||
ManageRoles,
|
||||
ViewPayments,
|
||||
ViewPages,
|
||||
ManagePages,
|
||||
ViewNewsletterMembers,
|
||||
ManageDashboard,
|
||||
ManageBlogs,
|
||||
ViewBlogs,
|
||||
ManageBrands,
|
||||
|
@ -211,6 +283,16 @@ public static class ApplicationClaims
|
|||
|
||||
public static List<Claim> AllClaims = new List<Claim>
|
||||
{
|
||||
ViewSettings.GetClaim,
|
||||
ManageSettings.GetClaim,
|
||||
ManageScraper.GetClaim,
|
||||
ViewRoles.GetClaim,
|
||||
ManageRoles.GetClaim,
|
||||
ViewPayments.GetClaim,
|
||||
ViewPages.GetClaim,
|
||||
ManagePages.GetClaim,
|
||||
ViewNewsletterMembers.GetClaim,
|
||||
ManageDashboard.GetClaim,
|
||||
ManageBlogs.GetClaim,
|
||||
ViewBlogs.GetClaim,
|
||||
ManageBrands.GetClaim,
|
||||
|
|
|
@ -2,6 +2,21 @@
|
|||
|
||||
public static class ApplicationPermission
|
||||
{
|
||||
public const string ViewSettings = nameof(ViewSettings);
|
||||
public const string ManageSettings = nameof(ManageSettings);
|
||||
|
||||
public const string ManageScraper = nameof(ManageScraper);
|
||||
|
||||
public const string ViewRoles = nameof(ViewRoles);
|
||||
public const string ManageRoles = nameof(ManageRoles);
|
||||
|
||||
public const string ViewPayments = nameof(ViewPayments);
|
||||
|
||||
public const string ViewNewsletterMembers = nameof(ViewNewsletterMembers);
|
||||
|
||||
public const string ViewPages = nameof(ViewPages);
|
||||
public const string ManagePages = nameof(ManagePages);
|
||||
|
||||
public const string ManageBlogs = nameof(ManageBlogs);
|
||||
public const string ViewBlogs = nameof(ViewBlogs);
|
||||
|
||||
|
@ -39,4 +54,6 @@ public static class ApplicationPermission
|
|||
|
||||
public const string ManageFiles = nameof(ManageFiles);
|
||||
public const string ViewFiles = nameof(ViewFiles);
|
||||
|
||||
public const string ManageDashboard = nameof(ManageDashboard);
|
||||
}
|
|
@ -78,7 +78,7 @@ public class ZarinpalService : IPaymentService
|
|||
|
||||
await _mediator.Send(new CreateOrUpdatePaymentCommand(payment.Id, payment.FactorNumber, payment.Amount, payment.Description,
|
||||
payment.TransactionCode, payment.CardPan, payment.Authority, payment.Type, payment.Status,
|
||||
payment.OrderId, payment.UserId), cancellationToken);
|
||||
payment.OrderId, payment.CustomerId), cancellationToken);
|
||||
|
||||
await _mediator.Send(new SubmitOrderPaymentCommand(payment.OrderId, OrderPaymentMethod.OnlinePayment, true),
|
||||
cancellationToken);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using NetinaShop.Domain.Entities.Orders;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NetinaShop.Domain.Entities.Orders;
|
||||
|
||||
namespace NetinaShop.Repository.Handlers.Orders;
|
||||
|
||||
|
@ -13,9 +14,21 @@ public class CreateBaseOrderCommandHandler : IRequestHandler<CreateBaseOrderComm
|
|||
public async Task<Order> Handle(CreateBaseOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (request.UserId == default)
|
||||
throw new AppException("User id is null");
|
||||
|
||||
var order = Order.Create(request.UserId);
|
||||
throw new AppException("Customer id is null");
|
||||
var customer = await _repositoryWrapper.SetRepository<Customer>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(c => c.UserId == request.UserId, cancellationToken);
|
||||
if (customer == null)
|
||||
{
|
||||
customer = new Customer
|
||||
{
|
||||
UserId = request.UserId
|
||||
};
|
||||
_repositoryWrapper.SetRepository<Customer>()
|
||||
.Add(customer);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
var order = Order.Create(customer.Id);
|
||||
|
||||
_repositoryWrapper.SetRepository<Order>()
|
||||
.Add(order);
|
||||
|
|
|
@ -15,20 +15,26 @@ public class GetUserOrdersQueryHandler : IRequestHandler<GetUserOrdersQuery, Lis
|
|||
}
|
||||
public async Task<List<OrderSDto>> Handle(GetUserOrdersQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
Guid userId = Guid.Empty;
|
||||
if (request.UserId == default)
|
||||
Guid customerId = Guid.Empty;
|
||||
if (request.CustomerId == default)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new AppException("Token is wrong", ApiResultStatusCode.UnAuthorized);
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out userId))
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("Token is wrong", ApiResultStatusCode.UnAuthorized);
|
||||
var customer = await _repositoryWrapper.SetRepository<Customer>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(c => c.UserId == userId, cancellationToken);
|
||||
if (customer == null)
|
||||
throw new AppException("User is not a customer");
|
||||
customerId = customer.Id;
|
||||
}
|
||||
else
|
||||
userId = request.UserId;
|
||||
customerId = request.CustomerId;
|
||||
|
||||
var orders = await _repositoryWrapper.SetRepository<Order>()
|
||||
.TableNoTracking
|
||||
.Where(o => o.UserId == userId)
|
||||
.Where(o => o.CustomerId == customerId)
|
||||
.Select(OrderMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,72 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NetinaShop.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChangeOrderUserIdToCustomerId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Customers_UserId",
|
||||
schema: "public",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "UserId",
|
||||
schema: "public",
|
||||
table: "Orders",
|
||||
newName: "CustomerId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Orders_UserId",
|
||||
schema: "public",
|
||||
table: "Orders",
|
||||
newName: "IX_Orders_CustomerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Customers_CustomerId",
|
||||
schema: "public",
|
||||
table: "Orders",
|
||||
column: "CustomerId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Customers_CustomerId",
|
||||
schema: "public",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "CustomerId",
|
||||
schema: "public",
|
||||
table: "Orders",
|
||||
newName: "UserId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Orders_CustomerId",
|
||||
schema: "public",
|
||||
table: "Orders",
|
||||
newName: "IX_Orders_UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Customers_UserId",
|
||||
schema: "public",
|
||||
table: "Orders",
|
||||
column: "UserId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
1936
NetinaShop.Repository/Migrations/20240415212810_AddCustomerIdToPayment.Designer.cs
generated
100644
1936
NetinaShop.Repository/Migrations/20240415212810_AddCustomerIdToPayment.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,72 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NetinaShop.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCustomerIdToPayment : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Payments_Users_UserId",
|
||||
schema: "public",
|
||||
table: "Payments");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "UserId",
|
||||
schema: "public",
|
||||
table: "Payments",
|
||||
newName: "CustomerId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Payments_UserId",
|
||||
schema: "public",
|
||||
table: "Payments",
|
||||
newName: "IX_Payments_CustomerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Payments_Customers_CustomerId",
|
||||
schema: "public",
|
||||
table: "Payments",
|
||||
column: "CustomerId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Payments_Customers_CustomerId",
|
||||
schema: "public",
|
||||
table: "Payments");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "CustomerId",
|
||||
schema: "public",
|
||||
table: "Payments",
|
||||
newName: "UserId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Payments_CustomerId",
|
||||
schema: "public",
|
||||
table: "Payments",
|
||||
newName: "IX_Payments_UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Payments_Users_UserId",
|
||||
schema: "public",
|
||||
table: "Payments",
|
||||
column: "UserId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -147,9 +147,11 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("CustomerId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
@ -165,7 +167,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
|
@ -175,7 +176,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
@ -188,14 +188,11 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.ToTable("Payments", "public");
|
||||
});
|
||||
|
@ -217,7 +214,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -230,7 +226,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ReadingTime")
|
||||
|
@ -240,7 +235,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Summery")
|
||||
|
@ -272,7 +266,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -286,7 +279,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -297,7 +289,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -315,7 +306,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -336,7 +326,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PageUrl")
|
||||
|
@ -351,7 +340,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -382,7 +370,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -437,7 +424,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("PriceCeiling")
|
||||
|
@ -450,7 +436,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
|
@ -483,9 +468,11 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("CustomerId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("DeliveredAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
|
@ -522,7 +509,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("OrderAt")
|
||||
|
@ -550,7 +536,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("ServicePrice")
|
||||
|
@ -565,14 +550,11 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.Property<double>("TotalProductsPrice")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiscountId");
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("DiscountId");
|
||||
|
||||
b.ToTable("Orders", "public");
|
||||
});
|
||||
|
@ -590,7 +572,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("DeliveryCost")
|
||||
|
@ -603,7 +584,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
|
@ -613,7 +593,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShippingId")
|
||||
|
@ -648,7 +627,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("HasDiscount")
|
||||
|
@ -661,7 +639,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
|
@ -695,7 +672,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -717,7 +693,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -734,7 +709,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -748,7 +722,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -780,7 +753,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EnglishName")
|
||||
|
@ -807,7 +779,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("PackingCost")
|
||||
|
@ -824,7 +795,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
|
@ -871,7 +841,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsBuyer")
|
||||
|
@ -887,7 +856,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
|
@ -900,7 +868,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
|
@ -929,7 +896,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Detail")
|
||||
|
@ -946,7 +912,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("ParentId")
|
||||
|
@ -959,7 +924,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
|
@ -989,7 +953,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
|
@ -1021,7 +984,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -1032,7 +994,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -1117,9 +1078,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("LatestVersionUsed")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
|
@ -1172,6 +1130,131 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.ToTable("Users", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Customer", 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<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("UserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Customers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Manager", 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<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<double>("LatestVersionUsed")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
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("UserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Managers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Marketer", 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>("FatherName")
|
||||
.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>("Shaba")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Marketers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.NewsletterMember", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
@ -1182,7 +1265,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
|
@ -1196,7 +1278,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
|
@ -1207,7 +1288,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -1237,9 +1317,11 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("CustomerId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
|
@ -1253,7 +1335,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
|
@ -1280,7 +1361,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
|
@ -1288,6 +1368,8 @@ namespace NetinaShop.Repository.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserAddresses", "public");
|
||||
|
@ -1303,7 +1385,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -1313,7 +1394,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
|
@ -1323,7 +1403,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
|
@ -1348,7 +1427,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("DeliveryCost")
|
||||
|
@ -1370,7 +1448,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -1381,7 +1458,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WarehouseName")
|
||||
|
@ -1515,19 +1591,19 @@ namespace NetinaShop.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Accounting.Payment", b =>
|
||||
{
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.Customer", "Customer")
|
||||
.WithMany()
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order")
|
||||
.WithMany("Payments")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b =>
|
||||
|
@ -1551,16 +1627,16 @@ namespace NetinaShop.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b =>
|
||||
{
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.Customer", "Customer")
|
||||
.WithMany()
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Discounts.Discount", null)
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("DiscountId");
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
b.Navigation("Customer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b =>
|
||||
|
@ -1663,10 +1739,44 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b =>
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Customer", b =>
|
||||
{
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithOne("Customer")
|
||||
.HasForeignKey("NetinaShop.Domain.Entities.Users.Customer", "UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Manager", b =>
|
||||
{
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithOne("Manager")
|
||||
.HasForeignKey("NetinaShop.Domain.Entities.Users.Manager", "UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Marketer", b =>
|
||||
{
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithOne("Marketer")
|
||||
.HasForeignKey("NetinaShop.Domain.Entities.Users.Marketer", "UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b =>
|
||||
{
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.Customer", null)
|
||||
.WithMany("Addresses")
|
||||
.HasForeignKey("CustomerId");
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
|
@ -1805,6 +1915,15 @@ namespace NetinaShop.Repository.Migrations
|
|||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b =>
|
||||
{
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Manager");
|
||||
|
||||
b.Navigation("Marketer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Customer", b =>
|
||||
{
|
||||
b.Navigation("Addresses");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue