From fa83401bd6afa1860f7c5e8784d999b5c345a1f6 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 21:05:58 +0300 Subject: [PATCH 1/9] Refactor DTOs and update naming conventions This commit renames DTO classes and their validators to follow a consistent naming convention, changing from `DTO` to `Dto`. Several namespaces and `using` directives have been updated accordingly. New `PaymentDto` and `PaymentView` classes have been added, and existing classes like `CreatePostDTO`, `PostViewDTO`, and `UpdatePostDTO` have been restructured. Interfaces such as `IAnalyticsService`, `IAssetService`, and others have been updated to reflect the new DTOs. Additionally, enums like `UserRoles` and `KycStatus` have been modified to use PascalCase. The `Services.cs` file has been adjusted for service registration, and controllers have been updated to utilize the new DTOs, enhancing overall code consistency and clarity. --- .../AutoMapper/CatalogProfile.cs | 2 +- .../AutoMapper/Payments/PaymentProfile.cs | 2 +- .../AutoMapper/Posts/PostProfile.cs | 4 +- .../AutoMapper/UserActivityProfile.cs | 4 +- .../AutoMapper/UserProfile.cs | 4 +- Dentizone.Application/DI/Services.cs | 11 +--- .../DTOs/Catalog/CategoryView.cs | 4 +- .../DTOs/Catalog/CreatedSubCategoryDTO.cs | 6 +-- .../DTOs/Catalog/SubCategoryDTO.cs | 4 +- .../DTOs/Favorites/FavoriteViewDto.cs | 2 +- .../DTOs/Payment/PaymentDto.cs | 11 ++++ .../DTOs/Payment/PaymentView.cs | 15 ++++++ .../DTOs/{PostDTO => Post}/CreatePostDTO.cs | 2 +- .../DTOs/{PostDTO => Post}/PostAssetView.cs | 2 +- .../PostFilterDto}/CategoryFilterDTO.cs | 2 +- .../PostFilterDto}/SidebarFilterDTO.cs | 2 +- .../PostFilterDto}/UserPreferenceDTO.cs | 2 +- .../DTOs/{PostDTO => Post}/PostViewDTO.cs | 2 +- .../DTOs/{PostDTO => Post}/UpdatePostDTO.cs | 2 +- .../DTOs/User/KycStatusDTO.cs | 6 +-- .../DTOs/User/LoggedInUser.cs | 2 +- .../DTOs/User/UserStateDTO.cs | 6 +-- .../CreatedUserActivityDTO.cs | 6 +-- .../UniversitiesByUserDto.cs | 2 +- .../UserActivityDTO.cs | 8 +-- .../{Analytics => }/IAnalyticsService.cs | 2 +- .../Interfaces/{Assets => }/IAssetService.cs | 2 +- .../Interfaces/{Cart => }/ICartService.cs | 2 +- .../{Catalog => }/ICatalogService.cs | 4 +- .../{Cloudinary => }/ICloudinaryService.cs | 2 +- .../{Favorites => }/IFavoritesService.cs | 2 +- .../Interfaces/{Order => }/IOrderService.cs | 2 +- .../Interfaces/IPaymentService.cs | 14 ++++++ .../Interfaces/{Post => }/IPostService.cs | 6 +-- .../Interfaces/IQAService.cs | 2 +- .../Interfaces/{Review => }/IReviewService.cs | 2 +- .../{Order => }/IShippingService.cs | 2 +- .../Interfaces/IUserActivityService.cs | 8 +-- .../Interfaces/{User => }/IUserService.cs | 6 +-- .../Services/AnalyticsService.cs | 2 +- .../Services/AssetService.cs | 2 +- .../Services/Authentication/AuthService.cs | 22 ++++---- .../Authentication/VerificationService.cs | 23 ++++----- Dentizone.Application/Services/BaseService.cs | 2 +- Dentizone.Application/Services/CartService.cs | 2 +- .../Services/CatalogService.cs | 6 +-- .../Services/CloudinaryService.cs | 2 +- .../Services/FavoriteService.cs | 2 +- Dentizone.Application/Services/MailService.cs | 18 +++---- .../Services/OrderService.cs | 5 +- .../Services/Payment/PaymentService.cs | 36 ++----------- .../Services/Payment/WalletService.cs | 2 +- Dentizone.Application/Services/PostService.cs | 5 +- Dentizone.Application/Services/QAService.cs | 4 +- .../Services/ReviewService.cs | 1 - .../Services/ShippingService.cs | 2 +- .../Services/UploadService.cs | 1 - .../Services/UserActivityService.cs | 12 ++--- Dentizone.Application/Services/UserService.cs | 10 ++-- .../Services/WithdrawalService.cs | 4 +- .../Validators/GUIDValidator.cs | 2 +- Dentizone.Domain/Entity/Wallet.cs | 2 +- Dentizone.Domain/Enums/Kyc.cs | 16 +++--- Dentizone.Domain/Enums/PaymentMethod.cs | 4 +- Dentizone.Domain/Enums/ReviewStatus.cs | 4 +- Dentizone.Domain/Enums/UserActivity.cs | 22 ++++---- Dentizone.Domain/Enums/UserAssetsType.cs | 8 +-- Dentizone.Domain/Enums/UserRoles.cs | 10 ++-- Dentizone.Domain/Enums/UserWallet.cs | 7 ++- Dentizone.Domain/Enums/WalletActivity.cs | 6 +-- .../Repositories/IPostRepository.cs | 14 +++--- .../ApiClient/ITruboSMTP.cs | 2 +- .../Cache/RedisService.cs | 50 +++++++++---------- .../DependencyInjection/ApiClient.cs | 2 +- .../DependencyInjection/AppIdentity.cs | 8 +-- .../Persistence/Seeder/CatalogSeeder.cs | 31 ++++++------ .../Persistence/Seeder/Posts.cs | 2 +- .../Repositories/AbstractRepository.cs | 2 +- .../Repositories/AnswerRepository.cs | 18 +++---- .../Repositories/AssetRepository.cs | 16 +++--- .../Repositories/CartRepository.cs | 16 +++--- .../Repositories/CategoryRepository.cs | 20 ++++---- .../Repositories/FavouriteRepository.cs | 14 +++--- .../Repositories/OrderItemRepository.cs | 8 +-- .../Repositories/OrderPickupRepository.cs | 16 +++--- .../Repositories/OrderRepository.cs | 22 ++++---- .../Repositories/OrderStatusRepository.cs | 10 ++-- .../Repositories/PaymentRepository.cs | 12 ++--- .../Repositories/PostAssetRepository.cs | 16 +++--- .../Repositories/PostRepsitory.cs | 36 ++++++------- .../Repositories/QuestionRepository.cs | 18 +++---- .../Repositories/ReviewRepository.cs | 16 +++--- .../Repositories/SaleTransactionRepository.cs | 12 ++--- .../Repositories/ShipInfoRepository.cs | 8 +-- .../ShipmentActivityRepository.cs | 12 ++--- .../Repositories/SubCategoryRepository.cs | 18 +++---- .../Repositories/UniversityRepository.cs | 20 ++++---- .../Repositories/UserActivityRepository.cs | 10 ++-- .../Repositories/UserAssetRepository.cs | 14 +++--- .../Repositories/UserRepository.cs | 26 +++++----- .../Repositories/WalletRepository.cs | 14 +++--- .../WithdrawalRequestRepository.cs | 24 ++++----- .../Controllers/AnalyticsController.cs | 2 +- .../Controllers/AuthenticationController.cs | 6 +-- .../Controllers/CartController.cs | 2 +- .../Controllers/CatalogController.cs | 2 +- .../Controllers/FavoritesController.cs | 2 +- .../Controllers/OrderController.cs | 1 - .../Controllers/PostsController.cs | 10 ++-- .../Controllers/QAController.cs | 16 +++--- .../Controllers/ReviewController.cs | 2 +- .../Controllers/ShippingController.cs | 2 +- .../Controllers/UsersController.cs | 2 +- .../Controllers/VerificationController.cs | 10 ++-- .../Controllers/WalletController.cs | 4 +- 115 files changed, 487 insertions(+), 494 deletions(-) create mode 100644 Dentizone.Application/DTOs/Payment/PaymentDto.cs create mode 100644 Dentizone.Application/DTOs/Payment/PaymentView.cs rename Dentizone.Application/DTOs/{PostDTO => Post}/CreatePostDTO.cs (97%) rename Dentizone.Application/DTOs/{PostDTO => Post}/PostAssetView.cs (72%) rename Dentizone.Application/DTOs/{PostFilterDTO => Post/PostFilterDto}/CategoryFilterDTO.cs (78%) rename Dentizone.Application/DTOs/{PostFilterDTO => Post/PostFilterDto}/SidebarFilterDTO.cs (83%) rename Dentizone.Application/DTOs/{PostFilterDTO => Post/PostFilterDto}/UserPreferenceDTO.cs (94%) rename Dentizone.Application/DTOs/{PostDTO => Post}/PostViewDTO.cs (93%) rename Dentizone.Application/DTOs/{PostDTO => Post}/UpdatePostDTO.cs (91%) rename Dentizone.Application/DTOs/{UserActivityDTO => UserActivity}/CreatedUserActivityDTO.cs (74%) rename Dentizone.Application/DTOs/{UserActivityDTO => UserActivity}/UniversitiesByUserDto.cs (72%) rename Dentizone.Application/DTOs/{UserActivityDTO => UserActivity}/UserActivityDTO.cs (86%) rename Dentizone.Application/Interfaces/{Analytics => }/IAnalyticsService.cs (87%) rename Dentizone.Application/Interfaces/{Assets => }/IAssetService.cs (85%) rename Dentizone.Application/Interfaces/{Cart => }/ICartService.cs (88%) rename Dentizone.Application/Interfaces/{Catalog => }/ICatalogService.cs (86%) rename Dentizone.Application/Interfaces/{Cloudinary => }/ICloudinaryService.cs (62%) rename Dentizone.Application/Interfaces/{Favorites => }/IFavoritesService.cs (86%) rename Dentizone.Application/Interfaces/{Order => }/IOrderService.cs (92%) create mode 100644 Dentizone.Application/Interfaces/IPaymentService.cs rename Dentizone.Application/Interfaces/{Post => }/IPostService.cs (84%) rename Dentizone.Application/Interfaces/{Review => }/IReviewService.cs (90%) rename Dentizone.Application/Interfaces/{Order => }/IShippingService.cs (81%) rename Dentizone.Application/Interfaces/{User => }/IUserService.cs (72%) diff --git a/Dentizone.Application/AutoMapper/CatalogProfile.cs b/Dentizone.Application/AutoMapper/CatalogProfile.cs index b7b3879..8f7f64c 100644 --- a/Dentizone.Application/AutoMapper/CatalogProfile.cs +++ b/Dentizone.Application/AutoMapper/CatalogProfile.cs @@ -14,7 +14,7 @@ public CatalogProfile() CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } \ No newline at end of file diff --git a/Dentizone.Application/AutoMapper/Payments/PaymentProfile.cs b/Dentizone.Application/AutoMapper/Payments/PaymentProfile.cs index 08d7348..c2940e8 100644 --- a/Dentizone.Application/AutoMapper/Payments/PaymentProfile.cs +++ b/Dentizone.Application/AutoMapper/Payments/PaymentProfile.cs @@ -1,5 +1,5 @@ using AutoMapper; -using Dentizone.Application.Services.Payment; +using Dentizone.Application.DTOs.Payment; using Dentizone.Domain.Entity; namespace Dentizone.Application.AutoMapper.Payments diff --git a/Dentizone.Application/AutoMapper/Posts/PostProfile.cs b/Dentizone.Application/AutoMapper/Posts/PostProfile.cs index fe0b02e..103061d 100644 --- a/Dentizone.Application/AutoMapper/Posts/PostProfile.cs +++ b/Dentizone.Application/AutoMapper/Posts/PostProfile.cs @@ -1,5 +1,5 @@ using AutoMapper; -using Dentizone.Application.DTOs.PostDTO; +using Dentizone.Application.DTOs.Post; using Dentizone.Domain.Entity; namespace Dentizone.Application.AutoMapper.Posts @@ -12,7 +12,7 @@ public PostProfile() .ReverseMap(); CreateMap().ReverseMap(); CreateMap() - .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.AssetId)) // Map AssetId to Id + .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.AssetId)) // Map AssetId to Id .ForMember(dest => dest.Url, opt => opt.MapFrom(src => src.Asset.Url)) // Map Asset.Url to Url .ReverseMap(); CreateMap() diff --git a/Dentizone.Application/AutoMapper/UserActivityProfile.cs b/Dentizone.Application/AutoMapper/UserActivityProfile.cs index 18d795b..9d70ec2 100644 --- a/Dentizone.Application/AutoMapper/UserActivityProfile.cs +++ b/Dentizone.Application/AutoMapper/UserActivityProfile.cs @@ -1,5 +1,5 @@ using AutoMapper; -using Dentizone.Application.DTOs.UserActivityDTO; +using Dentizone.Application.DTOs.UserActivity; using Dentizone.Domain.Entity; namespace Dentizone.Application.AutoMapper @@ -9,7 +9,7 @@ public class UserActivityProfile : Profile public UserActivityProfile() { CreateMap().ReverseMap(); - CreateMap() + CreateMap() .ReverseMap() .ForMember(dest => dest.UserName, opt => opt.MapFrom(src => src.User.Username)); } diff --git a/Dentizone.Application/AutoMapper/UserProfile.cs b/Dentizone.Application/AutoMapper/UserProfile.cs index fc0b623..f05a9b4 100644 --- a/Dentizone.Application/AutoMapper/UserProfile.cs +++ b/Dentizone.Application/AutoMapper/UserProfile.cs @@ -18,8 +18,8 @@ public UserProfile() CreateMap() .ReverseMap(); - CreateMap().ReverseMap(); - CreateMap() + CreateMap().ReverseMap(); + CreateMap() .ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.Status)) .ReverseMap() .ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.Status)); diff --git a/Dentizone.Application/DI/Services.cs b/Dentizone.Application/DI/Services.cs index 0d4fff0..addbaa5 100644 --- a/Dentizone.Application/DI/Services.cs +++ b/Dentizone.Application/DI/Services.cs @@ -1,13 +1,4 @@ using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.Analytics; -using Dentizone.Application.Interfaces.Assets; -using Dentizone.Application.Interfaces.Cart; -using Dentizone.Application.Interfaces.Catalog; -using Dentizone.Application.Interfaces.Cloudinary; -using Dentizone.Application.Interfaces.Favorites; -using Dentizone.Application.Interfaces.Order; -using Dentizone.Application.Interfaces.Post; -using Dentizone.Application.Interfaces.Review; using Dentizone.Application.Interfaces.User; using Dentizone.Application.Services; using Dentizone.Application.Services.Authentication; @@ -45,7 +36,7 @@ public static IServiceCollection AddApplicationServices(this IServiceCollection services.AddScoped(); services.AddScoped(); - services.AddScoped(); + services.AddScoped(); return services; } } diff --git a/Dentizone.Application/DTOs/Catalog/CategoryView.cs b/Dentizone.Application/DTOs/Catalog/CategoryView.cs index 3eb31e5..45ff407 100644 --- a/Dentizone.Application/DTOs/Catalog/CategoryView.cs +++ b/Dentizone.Application/DTOs/Catalog/CategoryView.cs @@ -8,9 +8,9 @@ public class CategoryView public string Name { get; set; } } - public class CreatedCategoryDTOValidator : AbstractValidator + public class CreatedCategoryDtoValidator : AbstractValidator { - public CreatedCategoryDTOValidator() + public CreatedCategoryDtoValidator() { RuleFor(x => x.Name) .NotEmpty().WithMessage("Category name is required.") diff --git a/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs b/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs index d6f3938..4c15a06 100644 --- a/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs +++ b/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs @@ -2,15 +2,15 @@ namespace Dentizone.Application.DTOs.Catalog { - public class CreatedSubCategoryDTO + public class CreatedSubCategoryDto { public string Id { get; set; } public string Name { get; set; } } - public class CreatedSubCategoryDTOValidator : AbstractValidator + public class CreatedSubCategoryDtoValidator : AbstractValidator { - public CreatedSubCategoryDTOValidator() + public CreatedSubCategoryDtoValidator() { RuleFor(x => x.Name) .NotEmpty().WithMessage("SubCategory name is required.") diff --git a/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs b/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs index b29e011..1c14bd7 100644 --- a/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs +++ b/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs @@ -8,9 +8,9 @@ public class SubCategoryDto public string CategoryId { get; set; } } - public class SubCategoryDTOValidator : AbstractValidator + public class SubCategoryDtoValidator : AbstractValidator { - public SubCategoryDTOValidator() + public SubCategoryDtoValidator() { RuleFor(x => x.Name) .NotEmpty().WithMessage("SubCategory name is required.") diff --git a/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs b/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs index 3820aa0..635c46e 100644 --- a/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs +++ b/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs @@ -1,4 +1,4 @@ -using Dentizone.Application.DTOs.PostDTO; +using Dentizone.Application.DTOs.Post; namespace Dentizone.Application.DTOs.Favorites { diff --git a/Dentizone.Application/DTOs/Payment/PaymentDto.cs b/Dentizone.Application/DTOs/Payment/PaymentDto.cs new file mode 100644 index 0000000..66a0793 --- /dev/null +++ b/Dentizone.Application/DTOs/Payment/PaymentDto.cs @@ -0,0 +1,11 @@ +using Dentizone.Domain.Enums; + +namespace Dentizone.Application.DTOs.Payment; + +public class PaymentDto +{ + public string OrderId { get; set; } + public string BuyerId { get; set; } + public decimal Amount { get; set; } + public PaymentMethod PaymentMethod { get; set; } +} \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Payment/PaymentView.cs b/Dentizone.Application/DTOs/Payment/PaymentView.cs new file mode 100644 index 0000000..9b53236 --- /dev/null +++ b/Dentizone.Application/DTOs/Payment/PaymentView.cs @@ -0,0 +1,15 @@ +using Dentizone.Domain.Enums; + +namespace Dentizone.Application.DTOs.Payment; + +public class PaymentView +{ + public string Id { get; set; } + public string OrderId { get; set; } + public string BuyerId { get; set; } + public string BuyerName { get; set; } + public decimal Amount { get; set; } + public PaymentMethod Method { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } +} \ No newline at end of file diff --git a/Dentizone.Application/DTOs/PostDTO/CreatePostDTO.cs b/Dentizone.Application/DTOs/Post/CreatePostDTO.cs similarity index 97% rename from Dentizone.Application/DTOs/PostDTO/CreatePostDTO.cs rename to Dentizone.Application/DTOs/Post/CreatePostDTO.cs index 9299601..1c8595e 100644 --- a/Dentizone.Application/DTOs/PostDTO/CreatePostDTO.cs +++ b/Dentizone.Application/DTOs/Post/CreatePostDTO.cs @@ -1,7 +1,7 @@ using Dentizone.Domain.Enums; using FluentValidation; -namespace Dentizone.Application.DTOs.PostDTO +namespace Dentizone.Application.DTOs.Post { public class CreatePostDto { diff --git a/Dentizone.Application/DTOs/PostDTO/PostAssetView.cs b/Dentizone.Application/DTOs/Post/PostAssetView.cs similarity index 72% rename from Dentizone.Application/DTOs/PostDTO/PostAssetView.cs rename to Dentizone.Application/DTOs/Post/PostAssetView.cs index da869b0..1cc2ee5 100644 --- a/Dentizone.Application/DTOs/PostDTO/PostAssetView.cs +++ b/Dentizone.Application/DTOs/Post/PostAssetView.cs @@ -1,4 +1,4 @@ -namespace Dentizone.Application.DTOs.PostDTO +namespace Dentizone.Application.DTOs.Post { public class PostAssetView { diff --git a/Dentizone.Application/DTOs/PostFilterDTO/CategoryFilterDTO.cs b/Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs similarity index 78% rename from Dentizone.Application/DTOs/PostFilterDTO/CategoryFilterDTO.cs rename to Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs index afae69b..cd31f44 100644 --- a/Dentizone.Application/DTOs/PostFilterDTO/CategoryFilterDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs @@ -1,4 +1,4 @@ -namespace Dentizone.Application.DTOs.PostFilterDTO +namespace Dentizone.Application.DTOs.Post.PostFilterDto { public class CategoryFilterDto { diff --git a/Dentizone.Application/DTOs/PostFilterDTO/SidebarFilterDTO.cs b/Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs similarity index 83% rename from Dentizone.Application/DTOs/PostFilterDTO/SidebarFilterDTO.cs rename to Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs index 94fe064..b905bab 100644 --- a/Dentizone.Application/DTOs/PostFilterDTO/SidebarFilterDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs @@ -1,4 +1,4 @@ -namespace Dentizone.Application.DTOs.PostFilterDTO +namespace Dentizone.Application.DTOs.Post.PostFilterDto { public class SidebarFilterDto { diff --git a/Dentizone.Application/DTOs/PostFilterDTO/UserPreferenceDTO.cs b/Dentizone.Application/DTOs/Post/PostFilterDto/UserPreferenceDTO.cs similarity index 94% rename from Dentizone.Application/DTOs/PostFilterDTO/UserPreferenceDTO.cs rename to Dentizone.Application/DTOs/Post/PostFilterDto/UserPreferenceDTO.cs index 2dc97dc..339ab18 100644 --- a/Dentizone.Application/DTOs/PostFilterDTO/UserPreferenceDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostFilterDto/UserPreferenceDTO.cs @@ -1,7 +1,7 @@ using Dentizone.Domain.Enums; using FluentValidation; -namespace Dentizone.Application.DTOs.PostFilterDTO +namespace Dentizone.Application.DTOs.Post.PostFilterDto { public class UserPreferenceDto { diff --git a/Dentizone.Application/DTOs/PostDTO/PostViewDTO.cs b/Dentizone.Application/DTOs/Post/PostViewDTO.cs similarity index 93% rename from Dentizone.Application/DTOs/PostDTO/PostViewDTO.cs rename to Dentizone.Application/DTOs/Post/PostViewDTO.cs index 1522155..abf2de8 100644 --- a/Dentizone.Application/DTOs/PostDTO/PostViewDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostViewDTO.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.User; -namespace Dentizone.Application.DTOs.PostDTO +namespace Dentizone.Application.DTOs.Post { public class PostViewDto { diff --git a/Dentizone.Application/DTOs/PostDTO/UpdatePostDTO.cs b/Dentizone.Application/DTOs/Post/UpdatePostDTO.cs similarity index 91% rename from Dentizone.Application/DTOs/PostDTO/UpdatePostDTO.cs rename to Dentizone.Application/DTOs/Post/UpdatePostDTO.cs index 4fc56ca..13ef1b8 100644 --- a/Dentizone.Application/DTOs/PostDTO/UpdatePostDTO.cs +++ b/Dentizone.Application/DTOs/Post/UpdatePostDTO.cs @@ -1,6 +1,6 @@ using Dentizone.Domain.Enums; -namespace Dentizone.Application.DTOs.PostDTO +namespace Dentizone.Application.DTOs.Post { public class UpdatePostDto { diff --git a/Dentizone.Application/DTOs/User/KycStatusDTO.cs b/Dentizone.Application/DTOs/User/KycStatusDTO.cs index 70aa7bd..faac2c5 100644 --- a/Dentizone.Application/DTOs/User/KycStatusDTO.cs +++ b/Dentizone.Application/DTOs/User/KycStatusDTO.cs @@ -3,14 +3,14 @@ namespace Dentizone.Application.DTOs.User { - public class KycStatusDTO + public class KycStatusDto { public KycStatus KycStatus { get; set; } } - public class KycStatusDTOValidator : AbstractValidator + public class KycStatusDtoValidator : AbstractValidator { - public KycStatusDTOValidator() + public KycStatusDtoValidator() { RuleFor(x => x.KycStatus) .IsInEnum() diff --git a/Dentizone.Application/DTOs/User/LoggedInUser.cs b/Dentizone.Application/DTOs/User/LoggedInUser.cs index b20ca36..cd6f43e 100644 --- a/Dentizone.Application/DTOs/User/LoggedInUser.cs +++ b/Dentizone.Application/DTOs/User/LoggedInUser.cs @@ -6,5 +6,5 @@ namespace Dentizone.Application.DTOs.User; public class LoggedInUser { public ApplicationUser User { get; set; } - public UserRoles role { get; set; } + public UserRoles Role { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/User/UserStateDTO.cs b/Dentizone.Application/DTOs/User/UserStateDTO.cs index 21fa51a..6764733 100644 --- a/Dentizone.Application/DTOs/User/UserStateDTO.cs +++ b/Dentizone.Application/DTOs/User/UserStateDTO.cs @@ -3,14 +3,14 @@ namespace Dentizone.Application.DTOs.User { - public class UserStateDTO + public class UserStateDto { public UserState Status { get; set; } } - public class UserStateDTOValidator : AbstractValidator + public class UserStateDtoValidator : AbstractValidator { - public UserStateDTOValidator() + public UserStateDtoValidator() { RuleFor(x => x.Status) .IsInEnum() diff --git a/Dentizone.Application/DTOs/UserActivityDTO/CreatedUserActivityDTO.cs b/Dentizone.Application/DTOs/UserActivity/CreatedUserActivityDTO.cs similarity index 74% rename from Dentizone.Application/DTOs/UserActivityDTO/CreatedUserActivityDTO.cs rename to Dentizone.Application/DTOs/UserActivity/CreatedUserActivityDTO.cs index 173d89c..de81ce5 100644 --- a/Dentizone.Application/DTOs/UserActivityDTO/CreatedUserActivityDTO.cs +++ b/Dentizone.Application/DTOs/UserActivity/CreatedUserActivityDTO.cs @@ -1,7 +1,7 @@ using Dentizone.Domain.Enums; using FluentValidation; -namespace Dentizone.Application.DTOs.UserActivityDTO +namespace Dentizone.Application.DTOs.UserActivity { public class CreatedUserActivityDto { @@ -9,9 +9,9 @@ public class CreatedUserActivityDto public UserActivities ActivityType { get; set; } } - public class CreatedUserActivityDTOValidator : AbstractValidator + public class CreatedUserActivityDtoValidator : AbstractValidator { - public CreatedUserActivityDTOValidator() + public CreatedUserActivityDtoValidator() { RuleFor(x => x.DetectedAt).NotEmpty().WithMessage("DetectedAt is required."); RuleFor(x => x.ActivityType).IsInEnum().WithMessage("ActivityType must be a valid enum value."); diff --git a/Dentizone.Application/DTOs/UserActivityDTO/UniversitiesByUserDto.cs b/Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs similarity index 72% rename from Dentizone.Application/DTOs/UserActivityDTO/UniversitiesByUserDto.cs rename to Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs index 8e6f65e..380e81d 100644 --- a/Dentizone.Application/DTOs/UserActivityDTO/UniversitiesByUserDto.cs +++ b/Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs @@ -1,4 +1,4 @@ -namespace Dentizone.Application.DTOs.UserActivityDTO +namespace Dentizone.Application.DTOs.UserActivity { public class UniversitiesByUserDto { diff --git a/Dentizone.Application/DTOs/UserActivityDTO/UserActivityDTO.cs b/Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs similarity index 86% rename from Dentizone.Application/DTOs/UserActivityDTO/UserActivityDTO.cs rename to Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs index b171982..05e9fe7 100644 --- a/Dentizone.Application/DTOs/UserActivityDTO/UserActivityDTO.cs +++ b/Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs @@ -1,9 +1,9 @@ using Dentizone.Domain.Enums; using FluentValidation; -namespace Dentizone.Application.DTOs.UserActivityDTO +namespace Dentizone.Application.DTOs.UserActivity { - public class UserActivityDTO + public class UserActivityDto { public string Id { get; set; } public string UserName { get; set; } @@ -16,9 +16,9 @@ public class UserActivityDTO public UserActivities ActivityType { get; set; } } - public class UserActivityDTOValidator : AbstractValidator + public class UserActivityDtoValidator : AbstractValidator { - public UserActivityDTOValidator() + public UserActivityDtoValidator() { RuleFor(x => x.Id).NotEmpty().WithMessage("Id is required."); RuleFor(x => x.UserId).NotEmpty().WithMessage("UserId is required."); diff --git a/Dentizone.Application/Interfaces/Analytics/IAnalyticsService.cs b/Dentizone.Application/Interfaces/IAnalyticsService.cs similarity index 87% rename from Dentizone.Application/Interfaces/Analytics/IAnalyticsService.cs rename to Dentizone.Application/Interfaces/IAnalyticsService.cs index e554133..5d785e9 100644 --- a/Dentizone.Application/Interfaces/Analytics/IAnalyticsService.cs +++ b/Dentizone.Application/Interfaces/IAnalyticsService.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.Analytics; -namespace Dentizone.Application.Interfaces.Analytics +namespace Dentizone.Application.Interfaces { public interface IAnalyticsService { diff --git a/Dentizone.Application/Interfaces/Assets/IAssetService.cs b/Dentizone.Application/Interfaces/IAssetService.cs similarity index 85% rename from Dentizone.Application/Interfaces/Assets/IAssetService.cs rename to Dentizone.Application/Interfaces/IAssetService.cs index 545b3e7..16fcd22 100644 --- a/Dentizone.Application/Interfaces/Assets/IAssetService.cs +++ b/Dentizone.Application/Interfaces/IAssetService.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.Assets; -namespace Dentizone.Application.Interfaces.Assets; +namespace Dentizone.Application.Interfaces; public interface IAssetService { diff --git a/Dentizone.Application/Interfaces/Cart/ICartService.cs b/Dentizone.Application/Interfaces/ICartService.cs similarity index 88% rename from Dentizone.Application/Interfaces/Cart/ICartService.cs rename to Dentizone.Application/Interfaces/ICartService.cs index ffa68ed..e8d2b49 100644 --- a/Dentizone.Application/Interfaces/Cart/ICartService.cs +++ b/Dentizone.Application/Interfaces/ICartService.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.Cart; -namespace Dentizone.Application.Interfaces.Cart +namespace Dentizone.Application.Interfaces { public interface ICartService { diff --git a/Dentizone.Application/Interfaces/Catalog/ICatalogService.cs b/Dentizone.Application/Interfaces/ICatalogService.cs similarity index 86% rename from Dentizone.Application/Interfaces/Catalog/ICatalogService.cs rename to Dentizone.Application/Interfaces/ICatalogService.cs index 9fd3508..d1c48ed 100644 --- a/Dentizone.Application/Interfaces/Catalog/ICatalogService.cs +++ b/Dentizone.Application/Interfaces/ICatalogService.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.Catalog; -namespace Dentizone.Application.Interfaces.Catalog; +namespace Dentizone.Application.Interfaces; public interface ICatalogService { @@ -10,7 +10,7 @@ public interface ICatalogService Task UpdateCategory(string userId, CategoryDto updatedCategoryDto); Task> GetAllCategories(); Task> GetSubCategoriesByCategoryId(string id); - Task CreateSubCategory(SubCategoryDto createdSubCategoryDto); + Task CreateSubCategory(SubCategoryDto createdSubCategoryDto); Task GetSubCategoryById(string id); Task DeleteSubCategory(string id); Task UpdateSubCategory(SubCategoryDto updatedSubCategoryDto); diff --git a/Dentizone.Application/Interfaces/Cloudinary/ICloudinaryService.cs b/Dentizone.Application/Interfaces/ICloudinaryService.cs similarity index 62% rename from Dentizone.Application/Interfaces/Cloudinary/ICloudinaryService.cs rename to Dentizone.Application/Interfaces/ICloudinaryService.cs index 1a098eb..f99b1b1 100644 --- a/Dentizone.Application/Interfaces/Cloudinary/ICloudinaryService.cs +++ b/Dentizone.Application/Interfaces/ICloudinaryService.cs @@ -1,4 +1,4 @@ -namespace Dentizone.Application.Interfaces.Cloudinary; +namespace Dentizone.Application.Interfaces; public interface ICloudinaryService { diff --git a/Dentizone.Application/Interfaces/Favorites/IFavoritesService.cs b/Dentizone.Application/Interfaces/IFavoritesService.cs similarity index 86% rename from Dentizone.Application/Interfaces/Favorites/IFavoritesService.cs rename to Dentizone.Application/Interfaces/IFavoritesService.cs index bd2d9fc..b23f779 100644 --- a/Dentizone.Application/Interfaces/Favorites/IFavoritesService.cs +++ b/Dentizone.Application/Interfaces/IFavoritesService.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.Favorites; -namespace Dentizone.Application.Interfaces.Favorites +namespace Dentizone.Application.Interfaces { public interface IFavoritesService { diff --git a/Dentizone.Application/Interfaces/Order/IOrderService.cs b/Dentizone.Application/Interfaces/IOrderService.cs similarity index 92% rename from Dentizone.Application/Interfaces/Order/IOrderService.cs rename to Dentizone.Application/Interfaces/IOrderService.cs index 8d45836..d4b22ef 100644 --- a/Dentizone.Application/Interfaces/Order/IOrderService.cs +++ b/Dentizone.Application/Interfaces/IOrderService.cs @@ -1,7 +1,7 @@ using Dentizone.Application.DTOs; using Dentizone.Application.DTOs.Order; -namespace Dentizone.Application.Interfaces.Order +namespace Dentizone.Application.Interfaces { public interface IOrderService { diff --git a/Dentizone.Application/Interfaces/IPaymentService.cs b/Dentizone.Application/Interfaces/IPaymentService.cs new file mode 100644 index 0000000..34c022a --- /dev/null +++ b/Dentizone.Application/Interfaces/IPaymentService.cs @@ -0,0 +1,14 @@ +using Dentizone.Application.DTOs.Payment; + +namespace Dentizone.Application.Interfaces; + +public interface IPaymentService +{ + Task CreatePaymentAsync(PaymentDto payment); + Task GetPaymentByIdAsync(string paymentId); + Task CreateSaleTransaction(string paymentId, string walletId, decimal amount); + + Task ConfirmPaymentAsync(string orderId); + + Task CancelPaymentByOrderId(string orderId); +} \ No newline at end of file diff --git a/Dentizone.Application/Interfaces/Post/IPostService.cs b/Dentizone.Application/Interfaces/IPostService.cs similarity index 84% rename from Dentizone.Application/Interfaces/Post/IPostService.cs rename to Dentizone.Application/Interfaces/IPostService.cs index bf61cd1..55422e5 100644 --- a/Dentizone.Application/Interfaces/Post/IPostService.cs +++ b/Dentizone.Application/Interfaces/IPostService.cs @@ -1,8 +1,8 @@ -using Dentizone.Application.DTOs.PostDTO; -using Dentizone.Application.DTOs.PostFilterDTO; +using Dentizone.Application.DTOs.Post; +using Dentizone.Application.DTOs.Post.PostFilterDto; using Dentizone.Domain.Enums; -namespace Dentizone.Application.Interfaces.Post +namespace Dentizone.Application.Interfaces { public interface IPostService { diff --git a/Dentizone.Application/Interfaces/IQAService.cs b/Dentizone.Application/Interfaces/IQAService.cs index d1f743a..472e7be 100644 --- a/Dentizone.Application/Interfaces/IQAService.cs +++ b/Dentizone.Application/Interfaces/IQAService.cs @@ -3,7 +3,7 @@ namespace Dentizone.Application.Interfaces { - public interface IQAService + public interface IQaService { Task AskQuestionAsync(CreateQuestionDto dto, string askerId); Task> GetQuestionsForPostAsync(string postId); diff --git a/Dentizone.Application/Interfaces/Review/IReviewService.cs b/Dentizone.Application/Interfaces/IReviewService.cs similarity index 90% rename from Dentizone.Application/Interfaces/Review/IReviewService.cs rename to Dentizone.Application/Interfaces/IReviewService.cs index 429bf3c..888d81c 100644 --- a/Dentizone.Application/Interfaces/Review/IReviewService.cs +++ b/Dentizone.Application/Interfaces/IReviewService.cs @@ -1,6 +1,6 @@ using Dentizone.Application.DTOs.Review; -namespace Dentizone.Application.Interfaces.Review +namespace Dentizone.Application.Interfaces { public interface IReviewService { diff --git a/Dentizone.Application/Interfaces/Order/IShippingService.cs b/Dentizone.Application/Interfaces/IShippingService.cs similarity index 81% rename from Dentizone.Application/Interfaces/Order/IShippingService.cs rename to Dentizone.Application/Interfaces/IShippingService.cs index d92b031..a71bb68 100644 --- a/Dentizone.Application/Interfaces/Order/IShippingService.cs +++ b/Dentizone.Application/Interfaces/IShippingService.cs @@ -1,6 +1,6 @@ using Dentizone.Domain.Enums; -namespace Dentizone.Application.Interfaces.Order +namespace Dentizone.Application.Interfaces { public interface IShippingService { diff --git a/Dentizone.Application/Interfaces/IUserActivityService.cs b/Dentizone.Application/Interfaces/IUserActivityService.cs index 5bf8522..826e6eb 100644 --- a/Dentizone.Application/Interfaces/IUserActivityService.cs +++ b/Dentizone.Application/Interfaces/IUserActivityService.cs @@ -1,4 +1,4 @@ -using Dentizone.Application.DTOs.UserActivityDTO; +using Dentizone.Application.DTOs.UserActivity; using Dentizone.Domain.Enums; namespace Dentizone.Application.Interfaces; @@ -6,10 +6,10 @@ namespace Dentizone.Application.Interfaces; public interface IUserActivityService { Task CreateAsync(UserActivities activity, - DateTime? detectedAt = null, string? userId = null); + DateTime? detectedAt = null, string? userId = null); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); - Task> GetAllByActivityTypeAndUserIdAsync( + Task> GetAllByActivityTypeAndUserIdAsync( int page, string userId, UserActivities activityType); } \ No newline at end of file diff --git a/Dentizone.Application/Interfaces/User/IUserService.cs b/Dentizone.Application/Interfaces/IUserService.cs similarity index 72% rename from Dentizone.Application/Interfaces/User/IUserService.cs rename to Dentizone.Application/Interfaces/IUserService.cs index 86743b0..876b58d 100644 --- a/Dentizone.Application/Interfaces/User/IUserService.cs +++ b/Dentizone.Application/Interfaces/IUserService.cs @@ -3,7 +3,7 @@ using Dentizone.Domain.Enums; using System.Linq.Expressions; -namespace Dentizone.Application.Interfaces.User +namespace Dentizone.Application.Interfaces { public interface IUserService { @@ -11,11 +11,11 @@ public interface IUserService Task GetByIdAsync(string id); Task> GetAllAsync(int page, string? searchByName = null, - Expression>? filterExpression = null); + Expression>? filterExpression = null); Task DeleteAsync(string id); Task SetKycStatusAsync(string userId, KycStatus status); - Task SetUserStateAsync(string userId, UserStateDTO userStateDto); + Task SetUserStateAsync(string userId, UserStateDto userStateDto); Task SetNationalId(string userId, string nationalId); } } \ No newline at end of file diff --git a/Dentizone.Application/Services/AnalyticsService.cs b/Dentizone.Application/Services/AnalyticsService.cs index 2b44b0e..2b7505f 100644 --- a/Dentizone.Application/Services/AnalyticsService.cs +++ b/Dentizone.Application/Services/AnalyticsService.cs @@ -1,5 +1,5 @@ using Dentizone.Application.DTOs.Analytics; -using Dentizone.Application.Interfaces.Analytics; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Interfaces; using Dentizone.Domain.Interfaces.Repositories; using Dentizone.Infrastructure.Cache; diff --git a/Dentizone.Application/Services/AssetService.cs b/Dentizone.Application/Services/AssetService.cs index 1bb1785..f7a6f1a 100644 --- a/Dentizone.Application/Services/AssetService.cs +++ b/Dentizone.Application/Services/AssetService.cs @@ -1,6 +1,6 @@ using AutoMapper; using Dentizone.Application.DTOs.Assets; -using Dentizone.Application.Interfaces.Assets; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Exceptions; using Dentizone.Domain.Interfaces.Repositories; diff --git a/Dentizone.Application/Services/Authentication/AuthService.cs b/Dentizone.Application/Services/Authentication/AuthService.cs index cae13a5..92482c5 100644 --- a/Dentizone.Application/Services/Authentication/AuthService.cs +++ b/Dentizone.Application/Services/Authentication/AuthService.cs @@ -34,7 +34,7 @@ public async Task GetUserRoleAsync(string userId) throw new NotFoundException("User does not have any roles assigned"); } - return Enum.Parse(currentRoles.FirstOrDefault() ?? UserRoles.GHOST.ToString()); + return Enum.Parse(currentRoles.FirstOrDefault() ?? UserRoles.Ghost.ToString()); } public async Task AlternateUserRoleAsync(UserRoles newRole, string userId) @@ -69,7 +69,7 @@ public async Task LoginWithEmailAndPassword(string email, string p if (isLockedOut) { - await userActivityService.CreateAsync(UserActivities.LOCKDOUT, DateTime.Now, user.Id); + await userActivityService.CreateAsync(UserActivities.Lockdout, DateTime.Now, user.Id); throw new UserLockedOutException( "User is locked out due to too many failed login attempts. Please try again later."); @@ -97,7 +97,7 @@ public async Task LoginWithEmailAndPassword(string email, string p // 4. Check if user is in role - if (roles.Contains(UserRoles.BLACKLISTED.ToString())) + if (roles.Contains(UserRoles.Blacklisted.ToString())) { throw new BadActionException("You're banned from using our platform."); } @@ -105,11 +105,11 @@ public async Task LoginWithEmailAndPassword(string email, string p // 5. Generate token await userManager.ResetAccessFailedCountAsync(user); - await userActivityService.CreateAsync(UserActivities.LOGIN, DateTime.Now, user.Id); + await userActivityService.CreateAsync(UserActivities.Login, DateTime.Now, user.Id); return new LoggedInUser() { User = user, - role = Enum.Parse(roles.FirstOrDefault()) + Role = Enum.Parse(roles.FirstOrDefault()) }; } @@ -137,7 +137,7 @@ public async Task RegisterWithEmailAndPassword(RegisterRequestDto // 3. Assign default role - await userManager.AddToRoleAsync(user, UserRoles.GHOST.ToString()); + await userManager.AddToRoleAsync(user, UserRoles.Ghost.ToString()); // 4. Send Verification Email @@ -146,7 +146,7 @@ public async Task RegisterWithEmailAndPassword(RegisterRequestDto return new LoggedInUser() { User = user, - role = UserRoles.GHOST + Role = UserRoles.Ghost }; } @@ -174,10 +174,10 @@ public async Task ConfirmEmail(string token, string userId) } // 4. Assign verified role - await AlternateUserRoleAsync(UserRoles.PARTILY_VERIFIED, user); - await userActivityService.CreateAsync(UserActivities.EMAIL_CONFIRMED, DateTime.Now, user.Id); + await AlternateUserRoleAsync(UserRoles.PartilyVerified, user); + await userActivityService.CreateAsync(UserActivities.EmailConfirmed, DateTime.Now, user.Id); // 4. Generate token - return GenerateToken(user.Id, user.Email, UserRoles.PARTILY_VERIFIED.ToString()); + return GenerateToken(user.Id, user.Email, UserRoles.PartilyVerified.ToString()); } public async Task SendVerificationEmail(string email) @@ -248,7 +248,7 @@ public async Task ResetPassword(string email, string token, string newPa throw new NotFoundException("User does not have any roles assigned"); } - await userActivityService.CreateAsync(UserActivities.PASSWORD_RESET); + await userActivityService.CreateAsync(UserActivities.PasswordReset); // 3. Generate token return GenerateToken(user.Id, user.Email, roles.FirstOrDefault()); } diff --git a/Dentizone.Application/Services/Authentication/VerificationService.cs b/Dentizone.Application/Services/Authentication/VerificationService.cs index 1ad8a9e..51299d6 100644 --- a/Dentizone.Application/Services/Authentication/VerificationService.cs +++ b/Dentizone.Application/Services/Authentication/VerificationService.cs @@ -1,6 +1,5 @@ using Dentizone.Application.DTOs.User; using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.User; using Dentizone.Domain.Enums; using Dentizone.Domain.Interfaces.Mail; using Dentizone.Domain.Interfaces.Secret; @@ -28,15 +27,15 @@ public class VerificationService : IVerificationService private static Dictionary MapVerificationStatusToEnum() { return new Dictionary - { - { "approved", KycStatus.APPROVED }, - { "declined", KycStatus.REJECTED }, - { "pending", KycStatus.PENDING } - }; + { + { "approved", KycStatus.Approved }, + { "declined", KycStatus.Rejected }, + { "pending", KycStatus.Pending } + }; } public VerificationService(IDiditApi diditApi, ISecretService secretService, IAuthService authService, - IUserService userService) + IUserService userService) { _diditApi = diditApi; _secretService = secretService; @@ -69,12 +68,12 @@ public async Task StartSessionAsync(string userId) }; var session = await _diditApi.CreateSessionAsync(request, _secretService.GetSecret("DiditApi")); - await _userService.SetKycStatusAsync(userId, KycStatus.NOT_SUBMITTED); + await _userService.SetKycStatusAsync(userId, KycStatus.NotSubmitted); await _mailService.Send(user.Email, "Dentizone: Verification Started", - "Thank you for starting the email verification process." + - " You can use this url to verify your identity" + - $" Verify Now" - ); + "Thank you for starting the email verification process." + + " You can use this url to verify your identity" + + $" Verify Now" + ); return session; } diff --git a/Dentizone.Application/Services/BaseService.cs b/Dentizone.Application/Services/BaseService.cs index bcf00d4..aa9d502 100644 --- a/Dentizone.Application/Services/BaseService.cs +++ b/Dentizone.Application/Services/BaseService.cs @@ -22,7 +22,7 @@ protected BaseService(IHttpContextAccessor httpContextAccessor) protected bool IsAdmin() { var userRole = _httpContextAccessor.HttpContext?.User.FindFirstValue(ClaimTypes.Role); - return Enum.TryParse(userRole, out var role) && role == UserRoles.ADMIN; + return Enum.TryParse(userRole, out var role) && role == UserRoles.Admin; } /// diff --git a/Dentizone.Application/Services/CartService.cs b/Dentizone.Application/Services/CartService.cs index 20824c7..8e333ed 100644 --- a/Dentizone.Application/Services/CartService.cs +++ b/Dentizone.Application/Services/CartService.cs @@ -1,6 +1,6 @@ using AutoMapper; using Dentizone.Application.DTOs.Cart; -using Dentizone.Application.Interfaces.Cart; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; diff --git a/Dentizone.Application/Services/CatalogService.cs b/Dentizone.Application/Services/CatalogService.cs index dc4a32e..0cac5a1 100644 --- a/Dentizone.Application/Services/CatalogService.cs +++ b/Dentizone.Application/Services/CatalogService.cs @@ -1,6 +1,6 @@ using AutoMapper; using Dentizone.Application.DTOs.Catalog; -using Dentizone.Application.Interfaces.Catalog; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Exceptions; using Dentizone.Domain.Interfaces.Repositories; @@ -72,7 +72,7 @@ public async Task> GetSubCategoriesByCategoryId(str return relatedSubCategories.Select(mapper.Map); } - public async Task CreateSubCategory(SubCategoryDto createdSubCategoryDto) + public async Task CreateSubCategory(SubCategoryDto createdSubCategoryDto) { var category = await categoryRepository.GetByIdAsync(createdSubCategoryDto.CategoryId); if (category == null) @@ -80,7 +80,7 @@ public async Task CreateSubCategory(SubCategoryDto create var subCategory = mapper.Map(createdSubCategoryDto); var createdSubCategory = await subCategoryRepository.CreateAsync(subCategory); - return mapper.Map(createdSubCategory); + return mapper.Map(createdSubCategory); } public async Task GetSubCategoryById(string id) diff --git a/Dentizone.Application/Services/CloudinaryService.cs b/Dentizone.Application/Services/CloudinaryService.cs index 60cd470..a694c8a 100644 --- a/Dentizone.Application/Services/CloudinaryService.cs +++ b/Dentizone.Application/Services/CloudinaryService.cs @@ -1,6 +1,6 @@ using CloudinaryDotNet; using CloudinaryDotNet.Actions; -using Dentizone.Application.Interfaces.Cloudinary; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Exceptions; using Dentizone.Domain.Interfaces.Secret; diff --git a/Dentizone.Application/Services/FavoriteService.cs b/Dentizone.Application/Services/FavoriteService.cs index 7c77039..a024d20 100644 --- a/Dentizone.Application/Services/FavoriteService.cs +++ b/Dentizone.Application/Services/FavoriteService.cs @@ -1,6 +1,6 @@ using AutoMapper; using Dentizone.Application.DTOs.Favorites; -using Dentizone.Application.Interfaces.Favorites; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Exceptions; using Dentizone.Domain.Interfaces.Repositories; diff --git a/Dentizone.Application/Services/MailService.cs b/Dentizone.Application/Services/MailService.cs index 53da6c3..f91eccb 100644 --- a/Dentizone.Application/Services/MailService.cs +++ b/Dentizone.Application/Services/MailService.cs @@ -4,22 +4,22 @@ namespace Dentizone.Application.Services { - internal class MailService(ITruboSMTP smtpApi, ISecretService secretService) : IMailService + internal class MailService(ITruboSmtp smtpApi, ISecretService secretService) : IMailService { public async Task Send(string to, string subject, string body) { var mailSecrets = new MailSecrets(secretService.GetSecret("TurboSmtpAuthUser"), - secretService.GetSecret("TurboSmtpAuthPass"), - secretService.GetSecret("TurboSmtpFrom")); + secretService.GetSecret("TurboSmtpAuthPass"), + secretService.GetSecret("TurboSmtpFrom")); var response = await smtpApi.SendEmailAsync( - new TurboSmtpEmailRequest(mailSecrets) - { - To = to, - Subject = subject, - Content = body - }); + new TurboSmtpEmailRequest(mailSecrets) + { + To = to, + Subject = subject, + Content = body + }); return response.Content; } diff --git a/Dentizone.Application/Services/OrderService.cs b/Dentizone.Application/Services/OrderService.cs index 30f1f79..465d398 100644 --- a/Dentizone.Application/Services/OrderService.cs +++ b/Dentizone.Application/Services/OrderService.cs @@ -2,9 +2,6 @@ using Dentizone.Application.DTOs; using Dentizone.Application.DTOs.Order; using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.Cart; -using Dentizone.Application.Interfaces.Order; -using Dentizone.Application.Interfaces.Post; using Dentizone.Application.Services.Payment; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; @@ -136,7 +133,7 @@ public async Task CreateOrderAsync(CreateOrderDto createOrderDto, string OrderId = result.Id, BuyerId = buyerId, Amount = result.TotalAmount, - PaymentMethod = PaymentMethod.COD + PaymentMethod = PaymentMethod.Cod }; var payment = await paymentService.CreatePaymentAsync(paymentDto); diff --git a/Dentizone.Application/Services/Payment/PaymentService.cs b/Dentizone.Application/Services/Payment/PaymentService.cs index db1c93c..96d6a75 100644 --- a/Dentizone.Application/Services/Payment/PaymentService.cs +++ b/Dentizone.Application/Services/Payment/PaymentService.cs @@ -1,4 +1,6 @@ using AutoMapper; +using Dentizone.Application.DTOs.Payment; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; @@ -7,27 +9,6 @@ namespace Dentizone.Application.Services.Payment { - public class PaymentDto - { - public string OrderId { get; set; } - public string BuyerId { get; set; } - public decimal Amount { get; set; } - public PaymentMethod PaymentMethod { get; set; } - } - - public class PaymentView - { - public string Id { get; set; } - public string OrderId { get; set; } - public string BuyerId { get; set; } - public string BuyerName { get; set; } - public decimal Amount { get; set; } - public PaymentMethod Method { get; set; } - public DateTime CreatedAt { get; set; } - public DateTime UpdatedAt { get; set; } - } - - public class PaymentService( IMapper mapper, IPaymentRepository repo, @@ -44,7 +25,7 @@ public async Task CreatePaymentAsync(PaymentDto payment) BuyerId = payment.BuyerId, Amount = payment.Amount, Status = PaymentStatus.Pending, - Method = PaymentMethod.COD + Method = PaymentMethod.Cod }; var createdPayment = await repo.CreateAsync(paymentEntity); @@ -189,15 +170,4 @@ public async Task CancelPaymentByOrderId(string orderId) } } } - - public interface IPaymentService - { - Task CreatePaymentAsync(PaymentDto payment); - Task GetPaymentByIdAsync(string paymentId); - Task CreateSaleTransaction(string paymentId, string walletId, decimal amount); - - Task ConfirmPaymentAsync(string orderId); - - Task CancelPaymentByOrderId(string orderId); - } } \ No newline at end of file diff --git a/Dentizone.Application/Services/Payment/WalletService.cs b/Dentizone.Application/Services/Payment/WalletService.cs index cf995be..d511e4a 100644 --- a/Dentizone.Application/Services/Payment/WalletService.cs +++ b/Dentizone.Application/Services/Payment/WalletService.cs @@ -69,7 +69,7 @@ public async Task CreateWallet(string userId) public async Task AddToBalance(decimal amount, string walletId) { - var wallet = await walletRepository.FindBy(w => w.Id == walletId && w.Status == UserWallet.ACTIVE); + var wallet = await walletRepository.FindBy(w => w.Id == walletId && w.Status == UserWallet.Active); if (wallet is null) { diff --git a/Dentizone.Application/Services/PostService.cs b/Dentizone.Application/Services/PostService.cs index 41aaa3e..3156956 100644 --- a/Dentizone.Application/Services/PostService.cs +++ b/Dentizone.Application/Services/PostService.cs @@ -1,8 +1,7 @@ using AutoMapper; -using Dentizone.Application.DTOs.PostDTO; +using Dentizone.Application.DTOs.Post; using Dentizone.Application.DTOs.PostFilterDTO; -using Dentizone.Application.Interfaces.Assets; -using Dentizone.Application.Interfaces.Post; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; diff --git a/Dentizone.Application/Services/QAService.cs b/Dentizone.Application/Services/QAService.cs index da42dcf..7a06d7e 100644 --- a/Dentizone.Application/Services/QAService.cs +++ b/Dentizone.Application/Services/QAService.cs @@ -10,8 +10,8 @@ namespace Dentizone.Application.Services { - public class QAService(IMapper mapper, IAnswerRepository answerRepository, IQuestionRepository questionRepository) - : IQAService + public class QaService(IMapper mapper, IAnswerRepository answerRepository, IQuestionRepository questionRepository) + : IQaService { public async Task AnswerQuestionAsync(string questionId, CreateAnswerDto dto, string responderId) { diff --git a/Dentizone.Application/Services/ReviewService.cs b/Dentizone.Application/Services/ReviewService.cs index d04e1f8..d15e150 100644 --- a/Dentizone.Application/Services/ReviewService.cs +++ b/Dentizone.Application/Services/ReviewService.cs @@ -1,6 +1,5 @@ using AutoMapper; using Dentizone.Application.DTOs.Review; -using Dentizone.Application.Interfaces.Order; using Dentizone.Application.Interfaces.Review; using Dentizone.Domain.Entity; using Dentizone.Domain.Interfaces.Repositories; diff --git a/Dentizone.Application/Services/ShippingService.cs b/Dentizone.Application/Services/ShippingService.cs index 89b812f..da16165 100644 --- a/Dentizone.Application/Services/ShippingService.cs +++ b/Dentizone.Application/Services/ShippingService.cs @@ -1,4 +1,4 @@ -using Dentizone.Application.Interfaces.Order; +using Dentizone.Application.Interfaces; using Dentizone.Application.Services.Authentication; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; diff --git a/Dentizone.Application/Services/UploadService.cs b/Dentizone.Application/Services/UploadService.cs index 1f0e1db..5fd2035 100644 --- a/Dentizone.Application/Services/UploadService.cs +++ b/Dentizone.Application/Services/UploadService.cs @@ -1,6 +1,5 @@ using Dentizone.Application.DTOs.Assets; using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.Assets; using Dentizone.Application.Interfaces.Cloudinary; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; diff --git a/Dentizone.Application/Services/UserActivityService.cs b/Dentizone.Application/Services/UserActivityService.cs index faab5fd..7916f3f 100644 --- a/Dentizone.Application/Services/UserActivityService.cs +++ b/Dentizone.Application/Services/UserActivityService.cs @@ -1,11 +1,11 @@ using AutoMapper; -using Dentizone.Application.DTOs.UserActivityDTO; using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; using Dentizone.Domain.Interfaces.Repositories; using System.Linq.Expressions; +using Dentizone.Application.DTOs.UserActivity; namespace Dentizone.Application.Services { @@ -16,7 +16,7 @@ public class UserActivityService( : IUserActivityService { public async Task CreateAsync(UserActivities activity, - DateTime? detectedAt = null, string? userId = null) + DateTime? detectedAt = null, string? userId = null) { var userActivity = new UserActivity { @@ -33,21 +33,21 @@ public async Task CreateAsync(UserActivities activity, return mapper.Map(newUserActivity); } - public async Task GetByIdAsync(string id) + public async Task GetByIdAsync(string id) { var userActivity = await userActivityRepository.GetByIdAsync(id); if (userActivity == null) throw new NotFoundException("There's no user activity with this id "); - return mapper.Map(userActivity); + return mapper.Map(userActivity); } - public async Task> GetAllByActivityTypeAndUserIdAsync( + public async Task> GetAllByActivityTypeAndUserIdAsync( int page, string userId, UserActivities activityType) { Expression> filter = ua => ua.UserId == userId && ua.ActivityType == activityType; var filteredActivities = await userActivityRepository.GetAllBy(page, filter); if (!filteredActivities.Any()) throw new NotFoundException($"No activities found for user {userId} with activity type {activityType}"); - var mapped = mapper.Map>(filteredActivities); + var mapped = mapper.Map>(filteredActivities); return mapped; } } diff --git a/Dentizone.Application/Services/UserService.cs b/Dentizone.Application/Services/UserService.cs index d4eb697..1f22569 100644 --- a/Dentizone.Application/Services/UserService.cs +++ b/Dentizone.Application/Services/UserService.cs @@ -1,7 +1,7 @@ using System.Linq.Expressions; using AutoMapper; using Dentizone.Application.DTOs.User; -using Dentizone.Application.Interfaces.User; +using Dentizone.Application.Interfaces; using Dentizone.Application.Services.Payment; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; @@ -83,7 +83,7 @@ public async Task GetByIdAsync(string id) } - public async Task SetUserStateAsync(string userId, UserStateDTO userStateDto) + public async Task SetUserStateAsync(string userId, UserStateDto userStateDto) { var user = await userRepository.GetByIdAsync(userId); if (user == null) @@ -106,9 +106,9 @@ public async Task SetKycStatusAsync(string userId, KycStatus status) user.Status = status switch { - KycStatus.APPROVED => UserState.Active, - KycStatus.REJECTED => UserState.Banned, - KycStatus.NOT_SUBMITTED => UserState.PendingVerification, + KycStatus.Approved => UserState.Active, + KycStatus.Rejected => UserState.Banned, + KycStatus.NotSubmitted => UserState.PendingVerification, _ => user.Status }; diff --git a/Dentizone.Application/Services/WithdrawalService.cs b/Dentizone.Application/Services/WithdrawalService.cs index a108d3b..69150ca 100644 --- a/Dentizone.Application/Services/WithdrawalService.cs +++ b/Dentizone.Application/Services/WithdrawalService.cs @@ -109,10 +109,10 @@ public async Task RejectWithdrawalAsync(string id, string if (updatedRequest == null) throw new NotFoundException("Failed to update withdrawal request."); - var UserId = updatedRequest.Wallet.UserId; + var userId = updatedRequest.Wallet.UserId; var subject = "Withdrawal Rejected"; var body = $"Your withdrawal request of {request.Amount:C} has been rejected. Reason: {adminNote}"; - await mailService.Send(UserId, subject, body); + await mailService.Send(userId, subject, body); return mapper.Map(updatedRequest); } diff --git a/Dentizone.Application/Validators/GUIDValidator.cs b/Dentizone.Application/Validators/GUIDValidator.cs index 9b4fdbd..fdd630b 100644 --- a/Dentizone.Application/Validators/GUIDValidator.cs +++ b/Dentizone.Application/Validators/GUIDValidator.cs @@ -7,7 +7,7 @@ namespace Dentizone.Application.Validators { - public static class GUIDValidator + public static class GuidValidator { public static IRuleBuilderOptions MustBeParsableGuid(this IRuleBuilder ruleBuilder) { diff --git a/Dentizone.Domain/Entity/Wallet.cs b/Dentizone.Domain/Entity/Wallet.cs index ebfaea5..830a48a 100644 --- a/Dentizone.Domain/Entity/Wallet.cs +++ b/Dentizone.Domain/Entity/Wallet.cs @@ -9,7 +9,7 @@ public class Wallet : IBaseEntity, IUpdatable public decimal Balance { get; set; } = 0.0m; - public UserWallet Status { get; set; } = UserWallet.ACTIVE; + public UserWallet Status { get; set; } = UserWallet.Active; public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } diff --git a/Dentizone.Domain/Enums/Kyc.cs b/Dentizone.Domain/Enums/Kyc.cs index 02e21c4..5174446 100644 --- a/Dentizone.Domain/Enums/Kyc.cs +++ b/Dentizone.Domain/Enums/Kyc.cs @@ -2,12 +2,12 @@ { public enum KycStatus { - APPROVED = 1, - PENDING = 2, - REJECTED = 3, - EXPIRED = 4, - UNDER_REVIEW = 5, - NOT_SUBMITTED = 6, - BLOCKED = 7 + Approved = 1, + Pending = 2, + Rejected = 3, + Expired = 4, + UnderReview = 5, + NotSubmitted = 6, + Blocked = 7 } -} +} \ No newline at end of file diff --git a/Dentizone.Domain/Enums/PaymentMethod.cs b/Dentizone.Domain/Enums/PaymentMethod.cs index c0ea99e..45926bc 100644 --- a/Dentizone.Domain/Enums/PaymentMethod.cs +++ b/Dentizone.Domain/Enums/PaymentMethod.cs @@ -3,6 +3,6 @@ public enum PaymentMethod { Card = 0, - COD = 1, + Cod = 1, } -} +} \ No newline at end of file diff --git a/Dentizone.Domain/Enums/ReviewStatus.cs b/Dentizone.Domain/Enums/ReviewStatus.cs index e7d9e53..f38c6ec 100644 --- a/Dentizone.Domain/Enums/ReviewStatus.cs +++ b/Dentizone.Domain/Enums/ReviewStatus.cs @@ -5,6 +5,6 @@ public enum ReviewStatus Active, Flagged, Removed, - PENDING, - REJECTED, + Pending, + Rejected, } \ No newline at end of file diff --git a/Dentizone.Domain/Enums/UserActivity.cs b/Dentizone.Domain/Enums/UserActivity.cs index dbf0802..3181038 100644 --- a/Dentizone.Domain/Enums/UserActivity.cs +++ b/Dentizone.Domain/Enums/UserActivity.cs @@ -2,16 +2,16 @@ { public enum UserActivities { - LOGIN, - REGISTER, - LOGOUT, - PASSWORD_RESET, - ORDER_PLACED, - ORDER_CANCELLED, - ORDER_COMPLETED, - PROFILE_UPDATED, - ACCOUNT_VERIFIED, - LOCKDOUT, - EMAIL_CONFIRMED + Login, + Register, + Logout, + PasswordReset, + OrderPlaced, + OrderCancelled, + OrderCompleted, + ProfileUpdated, + AccountVerified, + Lockdout, + EmailConfirmed } } \ No newline at end of file diff --git a/Dentizone.Domain/Enums/UserAssetsType.cs b/Dentizone.Domain/Enums/UserAssetsType.cs index 2561f91..894a44a 100644 --- a/Dentizone.Domain/Enums/UserAssetsType.cs +++ b/Dentizone.Domain/Enums/UserAssetsType.cs @@ -4,8 +4,8 @@ public enum UserAssetsType { ProfilePicture, KycDocument, - ID_PHOTO_FRONT, - ID_PHOTO_BACK, - KYC_FACE, + IdPhotoFront, + IdPhotoBack, + KycFace, } -} +} \ No newline at end of file diff --git a/Dentizone.Domain/Enums/UserRoles.cs b/Dentizone.Domain/Enums/UserRoles.cs index 44b6130..3208e44 100644 --- a/Dentizone.Domain/Enums/UserRoles.cs +++ b/Dentizone.Domain/Enums/UserRoles.cs @@ -2,10 +2,10 @@ { public enum UserRoles { - GHOST, - ADMIN, - VERIFIED, - PARTILY_VERIFIED, - BLACKLISTED, + Ghost, + Admin, + Verified, + PartilyVerified, + Blacklisted, } } \ No newline at end of file diff --git a/Dentizone.Domain/Enums/UserWallet.cs b/Dentizone.Domain/Enums/UserWallet.cs index eabd57d..b862bfd 100644 --- a/Dentizone.Domain/Enums/UserWallet.cs +++ b/Dentizone.Domain/Enums/UserWallet.cs @@ -2,8 +2,7 @@ { public enum UserWallet { - ACTIVE, - SUSPENDED, - + Active, + Suspended, } -} +} \ No newline at end of file diff --git a/Dentizone.Domain/Enums/WalletActivity.cs b/Dentizone.Domain/Enums/WalletActivity.cs index 1eacfa2..f2f4d15 100644 --- a/Dentizone.Domain/Enums/WalletActivity.cs +++ b/Dentizone.Domain/Enums/WalletActivity.cs @@ -2,7 +2,7 @@ { public enum WalletActivityTypes { - WITHDRAW, - DEPOSIT, + Withdraw, + Deposit, } -} +} \ No newline at end of file diff --git a/Dentizone.Domain/Interfaces/Repositories/IPostRepository.cs b/Dentizone.Domain/Interfaces/Repositories/IPostRepository.cs index e7ff859..da476cd 100644 --- a/Dentizone.Domain/Interfaces/Repositories/IPostRepository.cs +++ b/Dentizone.Domain/Interfaces/Repositories/IPostRepository.cs @@ -12,18 +12,18 @@ public interface IPostRepository : IBaseRepo Task> GetAllAsync(int page); Task> GetAllAsync(int page, - Expression>? filter, - Expression>? orderBy, - Expression>[]? includes = null + Expression>? filter, + Expression>? orderBy, + Expression>[]? includes = null ); IQueryable GetAllAsync(Expression>? filter, - Expression>? orderBy = null, - Expression>[]? includes = null); + Expression>? orderBy = null, + Expression>[]? includes = null); Task> SearchAsync(string? keyword, string? city, string? category, string? subcategory, - PostItemCondition? condition, decimal? minPrice, decimal? maxPrice, - string? sortBy, bool SortDirection, int page); + PostItemCondition? condition, decimal? minPrice, decimal? maxPrice, + string? sortBy, bool sortDirection, int page); Task UpdatePostStatus(string postId, PostStatus status); IQueryable GetActivePosts(); diff --git a/Dentizone.Infrastructure/ApiClient/ITruboSMTP.cs b/Dentizone.Infrastructure/ApiClient/ITruboSMTP.cs index e4c301f..471d12e 100644 --- a/Dentizone.Infrastructure/ApiClient/ITruboSMTP.cs +++ b/Dentizone.Infrastructure/ApiClient/ITruboSMTP.cs @@ -2,7 +2,7 @@ namespace Dentizone.Infrastructure.ApiClient; -public interface ITruboSMTP +public interface ITruboSmtp { [Post("/mail/send")] Task> SendEmailAsync([Body] TurboSmtpEmailRequest request); diff --git a/Dentizone.Infrastructure/Cache/RedisService.cs b/Dentizone.Infrastructure/Cache/RedisService.cs index d664392..6865402 100644 --- a/Dentizone.Infrastructure/Cache/RedisService.cs +++ b/Dentizone.Infrastructure/Cache/RedisService.cs @@ -6,63 +6,63 @@ namespace Dentizone.Infrastructure.Cache { public class RedisService : IRedisService, IDisposable, IAsyncDisposable { - private readonly ConnectionMultiplexer redis; - private readonly IDatabase database; + private readonly ConnectionMultiplexer _redis; + private readonly IDatabase _database; private readonly ISecretService _secretService; public RedisService(ISecretService secretService) { _secretService = secretService; - redis = ConnectionMultiplexer.Connect( - new ConfigurationOptions - { - EndPoints = - { - { - _secretService.GetSecret("RedisServer"), - int.Parse(_secretService.GetSecret("RedisPort")) - } - }, - User = "default", - Password = - _secretService - .GetSecret("RedisPassword") - } - ); - database = redis.GetDatabase(); + _redis = ConnectionMultiplexer.Connect( + new ConfigurationOptions + { + EndPoints = + { + { + _secretService.GetSecret("RedisServer"), + int.Parse(_secretService.GetSecret("RedisPort")) + } + }, + User = "default", + Password = + _secretService + .GetSecret("RedisPassword") + } + ); + _database = _redis.GetDatabase(); } public async Task SetValue(string key, string value) { - await database.StringSetAsync(key, value); + await _database.StringSetAsync(key, value); } public async Task SetValue(string key, string value, TimeSpan expireTime) { - await database.StringSetAsync(key, value, expireTime); + await _database.StringSetAsync(key, value, expireTime); } public async Task GetValue(string key) { - var value = await database.StringGetAsync(key); + var value = await _database.StringGetAsync(key); return value.IsNullOrEmpty ? null : value.ToString(); } public void Dispose() { - redis.Dispose(); + _redis.Dispose(); } public async ValueTask DisposeAsync() { - await redis.DisposeAsync(); + await _redis.DisposeAsync(); } public async Task InvalidateCache(string key) { - await database.KeyDeleteAsync(key); + await _database.KeyDeleteAsync(key); } } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/DependencyInjection/ApiClient.cs b/Dentizone.Infrastructure/DependencyInjection/ApiClient.cs index 41b8f11..a64b695 100644 --- a/Dentizone.Infrastructure/DependencyInjection/ApiClient.cs +++ b/Dentizone.Infrastructure/DependencyInjection/ApiClient.cs @@ -11,7 +11,7 @@ public static IServiceCollection AddApiClients(this IServiceCollection services) { services.AddRefitClient() .ConfigureHttpClient(c => { c.BaseAddress = new Uri("https://verification.didit.me"); }); - services.AddRefitClient() + services.AddRefitClient() .ConfigureHttpClient(c => { c.BaseAddress = new Uri("https://api.turbo-smtp.com/api/v2"); }); return services; } diff --git a/Dentizone.Infrastructure/DependencyInjection/AppIdentity.cs b/Dentizone.Infrastructure/DependencyInjection/AppIdentity.cs index 5d1c5e0..1f51eb8 100644 --- a/Dentizone.Infrastructure/DependencyInjection/AppIdentity.cs +++ b/Dentizone.Infrastructure/DependencyInjection/AppIdentity.cs @@ -40,18 +40,18 @@ public static IServiceCollection AddAppIdentity(this IServiceCollection services { // Policy for actions that require a fully verified (KYC) user options.AddPolicy("IsVerified", policy => - policy.RequireRole(UserRoles.VERIFIED.ToString())); + policy.RequireRole(UserRoles.Verified.ToString())); // Policy for actions that require at least an email-verified user options.AddPolicy("IsPartilyVerified", policy => policy.RequireRole( - UserRoles.PARTILY_VERIFIED.ToString(), - UserRoles.VERIFIED.ToString() // A verified user is also partially verified + UserRoles.PartilyVerified.ToString(), + UserRoles.Verified.ToString() // A verified user is also partially verified )); // Policy for admin-only actions options.AddPolicy("IsAdmin", policy => - policy.RequireRole(UserRoles.ADMIN.ToString())); + policy.RequireRole(UserRoles.Admin.ToString())); }); diff --git a/Dentizone.Infrastructure/Persistence/Seeder/CatalogSeeder.cs b/Dentizone.Infrastructure/Persistence/Seeder/CatalogSeeder.cs index 8a7a4b3..ef12ad2 100644 --- a/Dentizone.Infrastructure/Persistence/Seeder/CatalogSeeder.cs +++ b/Dentizone.Infrastructure/Persistence/Seeder/CatalogSeeder.cs @@ -1,40 +1,41 @@ using Bogus; using Dentizone.Domain.Entity; -using Dentizone.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Dentizone.Infrastructure.Persistence.Seeder; + public static class CatalogSeeder { public static async Task SeedCategoriesAndSubCategoriesAsync(AppDbContext context, int categoryCount = 10, - int subCategoryPerCategory = 5) + int subCategoryPerCategory = 5) { if (await context.Categories.AnyAsync()) return; // Already seeded // Generate Categories with random IconUrl var categoryFaker = new Faker() - .RuleFor(c => c.Id, f => Guid.NewGuid().ToString()) - .RuleFor(c => c.Name, f => f.Commerce.Categories(1)[0]) - .RuleFor(c => c.IconUrl, f => f.Internet.Avatar()) - .RuleFor(c => c.CreatedAt, f => f.Date.Past()) - .RuleFor(c => c.UpdatedAt, f => f.Date.Recent()) - .RuleFor(c => c.IsDeleted, false); + .RuleFor(c => c.Id, f => Guid.NewGuid().ToString()) + .RuleFor(c => c.Name, f => f.Commerce.Categories(1)[0]) + .RuleFor(c => c.IconUrl, f => f.Internet.Avatar()) + .RuleFor(c => c.CreatedAt, f => f.Date.Past()) + .RuleFor(c => c.UpdatedAt, f => f.Date.Recent()) + .RuleFor(c => c.IsDeleted, false); var categories = categoryFaker.Generate(categoryCount); // Generate SubCategories for each Category, ensuring CategoryId is set var subCategoryFaker = new Faker() - .RuleFor(sc => sc.Id, f => Guid.NewGuid().ToString()) - .RuleFor(sc => sc.Name, f => f.Commerce.Department()) - .RuleFor(sc => sc.CreatedAt, f => f.Date.Past()) - .RuleFor(sc => sc.UpdatedAt, f => f.Date.Recent()) - .RuleFor(sc => sc.IsDeleted, false); + .RuleFor(sc => sc.Id, f => Guid.NewGuid().ToString()) + .RuleFor(sc => sc.Name, f => f.Commerce.Department()) + .RuleFor(sc => sc.CreatedAt, f => f.Date.Past()) + .RuleFor(sc => sc.UpdatedAt, f => f.Date.Recent()) + .RuleFor(sc => sc.IsDeleted, false); foreach (var category in categories) { var subCategories = subCategoryFaker.Clone() - .RuleFor(sc => sc.CategoryId, _ => category.Id) - .Generate(subCategoryPerCategory); + .RuleFor(sc => sc.CategoryId, _ => category.Id) + .Generate(subCategoryPerCategory); context.SubCategories.AddRange(subCategories); diff --git a/Dentizone.Infrastructure/Persistence/Seeder/Posts.cs b/Dentizone.Infrastructure/Persistence/Seeder/Posts.cs index ca48435..5220b82 100644 --- a/Dentizone.Infrastructure/Persistence/Seeder/Posts.cs +++ b/Dentizone.Infrastructure/Persistence/Seeder/Posts.cs @@ -49,7 +49,7 @@ public static async Task SeedAsync(AppDbContext context, UserManager CreateAsync(Answer entity) { - await dbContext.Answers.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Answers.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } @@ -18,10 +18,10 @@ public async Task CreateAsync(Answer entity) public async Task FindBy(Expression> condition, Expression>[]? includes) { - var query = dbContext.Answers.AsQueryable(); + var query = DbContext.Answers.AsQueryable(); if (includes == null) - return await dbContext.Answers + return await DbContext.Answers .FirstOrDefaultAsync(condition); @@ -41,21 +41,21 @@ public async Task CreateAsync(Answer entity) var answer = await GetByIdAsync(id); - dbContext.Answers.Remove(answer); - await dbContext.SaveChangesAsync(); + DbContext.Answers.Remove(answer); + await DbContext.SaveChangesAsync(); return answer; } public async Task GetByIdAsync(string id) { - return await dbContext.Answers.FindAsync(id); + return await DbContext.Answers.FindAsync(id); } public async Task UpdateAsync(Answer entity) { - dbContext.Answers.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Answers.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } } diff --git a/Dentizone.Infrastructure/Repositories/AssetRepository.cs b/Dentizone.Infrastructure/Repositories/AssetRepository.cs index eeaece8..923a3f6 100644 --- a/Dentizone.Infrastructure/Repositories/AssetRepository.cs +++ b/Dentizone.Infrastructure/Repositories/AssetRepository.cs @@ -9,15 +9,15 @@ internal class AssetRepository(AppDbContext dbContext) : AbstractRepository(dbCo { public async Task CreateAsync(Asset entity) { - await dbContext.Assets.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Assets.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes = null) { - var query = dbContext.Assets.AsQueryable(); + var query = DbContext.Assets.AsQueryable(); if (includes == null) return await query .FirstOrDefaultAsync(condition); @@ -40,22 +40,22 @@ public async Task DeleteByIdAsync(string assetId) return; } - dbContext.Assets.Remove(asset); + DbContext.Assets.Remove(asset); - await dbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(); } public async Task GetByIdAsync(string id) { - return await dbContext.Assets + return await DbContext.Assets .FirstOrDefaultAsync(a => a.Id == id && !a.IsDeleted); } public async Task UpdateAsync(Asset entity) { - dbContext.Assets.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Assets.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } } diff --git a/Dentizone.Infrastructure/Repositories/CartRepository.cs b/Dentizone.Infrastructure/Repositories/CartRepository.cs index 3239d9e..7c74b92 100644 --- a/Dentizone.Infrastructure/Repositories/CartRepository.cs +++ b/Dentizone.Infrastructure/Repositories/CartRepository.cs @@ -9,22 +9,22 @@ internal class CartRepository(AppDbContext dbContext) : AbstractRepository(dbCon { public async Task GetByIdAsync(string id) { - return await dbContext.Carts + return await DbContext.Carts .FirstOrDefaultAsync(c => c.Id == id && !c.IsDeleted); } public async Task CreateAsync(Cart entity) { - await dbContext.Carts.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Carts.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.Carts; + IQueryable query = DbContext.Carts; if (includes == null) return await query.FirstOrDefaultAsync(condition); foreach (var include in includes) { @@ -42,15 +42,15 @@ public async Task CreateAsync(Cart entity) return null; } - dbContext.Carts.Remove(cart); - await dbContext.SaveChangesAsync(); + DbContext.Carts.Remove(cart); + await DbContext.SaveChangesAsync(); return cart; } public async Task> FindAllBy(Expression> condition, Expression>[]? includes = null) { - IQueryable query = dbContext.Carts; + IQueryable query = DbContext.Carts; if (includes != null) { @@ -65,7 +65,7 @@ public async Task> FindAllBy(Expression> cond public async Task> GetCartItemsByUserId(string userId) { - var baseQuery = dbContext.Carts + var baseQuery = DbContext.Carts .Where(c => c.UserId == userId && !c.IsDeleted) .Include(c => c.User) .Include(c => c.Post) diff --git a/Dentizone.Infrastructure/Repositories/CategoryRepository.cs b/Dentizone.Infrastructure/Repositories/CategoryRepository.cs index c663e91..e48977d 100644 --- a/Dentizone.Infrastructure/Repositories/CategoryRepository.cs +++ b/Dentizone.Infrastructure/Repositories/CategoryRepository.cs @@ -7,19 +7,19 @@ namespace Dentizone.Infrastructure.Repositories { public class CategoryRepository(AppDbContext dbContext) : AbstractRepository(dbContext), ICategoryRepository { - private readonly AppDbContext DbContext = dbContext; + private readonly AppDbContext _dbContext = dbContext; public async Task CreateAsync(Category entity) { - await DbContext.Categories.AddAsync(entity); - await DbContext.SaveChangesAsync(); + await _dbContext.Categories.AddAsync(entity); + await _dbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition , Expression>[]? includes) { - IQueryable query = DbContext.Categories; + IQueryable query = _dbContext.Categories; if (includes == null) return await query.FirstOrDefaultAsync(condition); foreach (var include in includes) { @@ -32,15 +32,15 @@ public async Task CreateAsync(Category entity) public async Task GetByIdAsync(string id) { - var category = await DbContext.Categories.Where(c => c.Id == id && !c.IsDeleted) + var category = await _dbContext.Categories.Where(c => c.Id == id && !c.IsDeleted) .FirstOrDefaultAsync(); return category; } public async Task Update(Category entity) { - DbContext.Categories.Update(entity); - await DbContext.SaveChangesAsync(); + _dbContext.Categories.Update(entity); + await _dbContext.SaveChangesAsync(); return entity; } @@ -53,14 +53,14 @@ public async Task CreateAsync(Category entity) return null; } - DbContext.Categories.Remove(category); - await DbContext.SaveChangesAsync(); + _dbContext.Categories.Remove(category); + await _dbContext.SaveChangesAsync(); return category; } public async Task> GetAll() { - return await DbContext.Categories + return await _dbContext.Categories .Where(c => !c.IsDeleted) .ToListAsync(); } diff --git a/Dentizone.Infrastructure/Repositories/FavouriteRepository.cs b/Dentizone.Infrastructure/Repositories/FavouriteRepository.cs index 69dcc7f..ccafb85 100644 --- a/Dentizone.Infrastructure/Repositories/FavouriteRepository.cs +++ b/Dentizone.Infrastructure/Repositories/FavouriteRepository.cs @@ -9,22 +9,22 @@ public class FavouriteRepository(AppDbContext dbContext) : AbstractRepository(db { public async Task GetByIdAsync(string id) { - return await dbContext.Favourites + return await DbContext.Favourites .FirstOrDefaultAsync(f => f.Id == id && !f.IsDeleted); } public async Task CreateAsync(Favourite entity) { - await dbContext.Favourites.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Favourites.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? incldues) { - IQueryable query = dbContext.Favourites; + IQueryable query = DbContext.Favourites; if (incldues != null) { foreach (var include in incldues) @@ -44,14 +44,14 @@ public async Task CreateAsync(Favourite entity) return null; } - dbContext.Favourites.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.Favourites.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } public async Task> FindAllByAsync(Expression> condition) { - IQueryable query = dbContext.Favourites; + IQueryable query = DbContext.Favourites; query = query.Include(f => f.Post) .ThenInclude(pa => pa.PostAssets) diff --git a/Dentizone.Infrastructure/Repositories/OrderItemRepository.cs b/Dentizone.Infrastructure/Repositories/OrderItemRepository.cs index 58de54b..af2d7a5 100644 --- a/Dentizone.Infrastructure/Repositories/OrderItemRepository.cs +++ b/Dentizone.Infrastructure/Repositories/OrderItemRepository.cs @@ -10,22 +10,22 @@ public class OrderItemRepository(AppDbContext dbContext) : AbstractRepository(db public async Task GetByIdAsync(string id) { return - await dbContext.OrderItems + await DbContext.OrderItems .FirstOrDefaultAsync(o => o.Id == id); } public async Task CreateAsync(OrderItem entity) { - await dbContext.OrderItems.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.OrderItems.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.OrderItems; + IQueryable query = DbContext.OrderItems; if (includes != null) { foreach (var include in includes) diff --git a/Dentizone.Infrastructure/Repositories/OrderPickupRepository.cs b/Dentizone.Infrastructure/Repositories/OrderPickupRepository.cs index 3e92919..291e814 100644 --- a/Dentizone.Infrastructure/Repositories/OrderPickupRepository.cs +++ b/Dentizone.Infrastructure/Repositories/OrderPickupRepository.cs @@ -9,15 +9,15 @@ public class OrderPickupRepository(AppDbContext dbContext) : AbstractRepository( { public async Task CreateAsync(OrderPickup entity) { - await dbContext.OrderPickups.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.OrderPickups.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.OrderPickups; + IQueryable query = DbContext.OrderPickups; if (includes != null) { foreach (var include in includes) @@ -33,8 +33,8 @@ public async Task CreateAsync(OrderPickup entity) public async Task UpdateAsync(OrderPickup entity) { - dbContext.OrderPickups.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.OrderPickups.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } @@ -46,15 +46,15 @@ public async Task UpdateAsync(OrderPickup entity) return null; } - dbContext.OrderPickups.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.OrderPickups.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } public async Task GetByIdAsync(string id) { - return await dbContext.OrderPickups + return await DbContext.OrderPickups .FirstOrDefaultAsync(o => o.Id == id && !o.IsDeleted); } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/Repositories/OrderRepository.cs b/Dentizone.Infrastructure/Repositories/OrderRepository.cs index b7cdfea..3d2d7a5 100644 --- a/Dentizone.Infrastructure/Repositories/OrderRepository.cs +++ b/Dentizone.Infrastructure/Repositories/OrderRepository.cs @@ -10,28 +10,28 @@ public class OrderRepository(AppDbContext dbContext) : AbstractRepository(dbCont { public async Task GetByIdAsync(string id) { - return await dbContext.Orders + return await DbContext.Orders .FirstOrDefaultAsync(o => o.Id == id); } public async Task UpdateAsync(Order entity) { - dbContext.Orders.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Orders.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task CreateAsync(Order entity) { - await dbContext.Orders.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Orders.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes = null) { - IQueryable query = dbContext.Orders; + IQueryable query = DbContext.Orders; if (includes != null) { foreach (var include in includes) @@ -68,7 +68,7 @@ private IQueryable BuildPagedQuery(int page, Expression public async Task> GetAllAsync(int? page, Expression> filter) { - var query = dbContext.Orders.AsQueryable(); + var query = DbContext.Orders.AsQueryable(); if (page is not null) { query = BuildPagedQuery(page.Value, filter, query); @@ -99,7 +99,7 @@ public async Task> GetAllAsync(int? page, Expression GetOrderDetails(string orderId, string buyerId) { - var query = dbContext.Orders + var query = DbContext.Orders .AsNoTracking() .Where(o => o.Id == orderId && o.BuyerId == buyerId) .Include(o => o.Buyer) @@ -112,7 +112,7 @@ public async Task> GetAllAsync(int? page, Expression> GetOrdersWithDetails(string buyerId) { - return await dbContext.Orders + return await DbContext.Orders .AsNoTracking() .Where(o => o.BuyerId == buyerId) .Include(o => o.Buyer) @@ -126,13 +126,13 @@ public async Task> GetOrdersWithDetails(string buyerI public async Task CountTotalOrders() { - var result = await dbContext.Orders.Where(o => !o.IsDeleted).AsNoTracking().CountAsync(); + var result = await DbContext.Orders.Where(o => !o.IsDeleted).AsNoTracking().CountAsync(); return result; } public async Task AverageValueOfOrders() { - var average = await dbContext.Orders + var average = await DbContext.Orders .AsNoTracking() .Where(o => !o.IsDeleted) .AverageAsync(o => (decimal?)o.TotalAmount); diff --git a/Dentizone.Infrastructure/Repositories/OrderStatusRepository.cs b/Dentizone.Infrastructure/Repositories/OrderStatusRepository.cs index 7540ae4..cf0b66d 100644 --- a/Dentizone.Infrastructure/Repositories/OrderStatusRepository.cs +++ b/Dentizone.Infrastructure/Repositories/OrderStatusRepository.cs @@ -9,22 +9,22 @@ public class OrderStatusRepository(AppDbContext dbContext) : AbstractRepository( { public async Task GetByIdAsync(string id) { - return await dbContext.OrderStatuses + return await DbContext.OrderStatuses .FirstOrDefaultAsync(o => o.Id == id); } public async Task CreateAsync(OrderStatus entity) { - await dbContext.OrderStatuses.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.OrderStatuses.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.OrderStatuses; + IQueryable query = DbContext.OrderStatuses; if (includes != null) { foreach (var include in includes) @@ -39,7 +39,7 @@ public async Task CreateAsync(OrderStatus entity) public async Task> Find(Expression> filter) { - return await dbContext.OrderStatuses + return await DbContext.OrderStatuses .Where(filter) .ToListAsync(); } diff --git a/Dentizone.Infrastructure/Repositories/PaymentRepository.cs b/Dentizone.Infrastructure/Repositories/PaymentRepository.cs index 37dd762..95d357e 100644 --- a/Dentizone.Infrastructure/Repositories/PaymentRepository.cs +++ b/Dentizone.Infrastructure/Repositories/PaymentRepository.cs @@ -9,15 +9,15 @@ internal class PaymentRepository(AppDbContext dbContext) : AbstractRepository(db { public async Task CreateAsync(Payment entity) { - await dbContext.Payments.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Payments.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.Payments; + IQueryable query = DbContext.Payments; if (includes != null) { foreach (var include in includes) @@ -32,15 +32,15 @@ public async Task CreateAsync(Payment entity) public async Task GetByIdAsync(string id) { - var payment = await dbContext.Payments.Where(w => w.Id == id).FirstOrDefaultAsync(); + var payment = await DbContext.Payments.Where(w => w.Id == id).FirstOrDefaultAsync(); return payment; } public async Task UpdateAsync(Payment entity) { - dbContext.Payments.Update(entity); + DbContext.Payments.Update(entity); - await dbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(); return entity; } diff --git a/Dentizone.Infrastructure/Repositories/PostAssetRepository.cs b/Dentizone.Infrastructure/Repositories/PostAssetRepository.cs index 9c0a37d..679cbf2 100644 --- a/Dentizone.Infrastructure/Repositories/PostAssetRepository.cs +++ b/Dentizone.Infrastructure/Repositories/PostAssetRepository.cs @@ -9,15 +9,15 @@ internal class PostAssetRepository(AppDbContext dbContext) : AbstractRepository( { public async Task CreateAsync(PostAsset entity) { - await dbContext.PostAssets.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.PostAssets.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.PostAssets; + IQueryable query = DbContext.PostAssets; if (includes == null) return await query.FirstOrDefaultAsync(condition); foreach (var include in includes) { @@ -31,21 +31,21 @@ public async Task CreateAsync(PostAsset entity) { var postAsset = await GetByIdAsync(id); - dbContext.PostAssets.Remove(postAsset); - await dbContext.SaveChangesAsync(); + DbContext.PostAssets.Remove(postAsset); + await DbContext.SaveChangesAsync(); return postAsset; } public async Task GetByIdAsync(string id) { - return await dbContext.PostAssets.FindAsync(id); + return await DbContext.PostAssets.FindAsync(id); } public async Task UpdateAsync(PostAsset entity) { - dbContext.PostAssets.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.PostAssets.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } } diff --git a/Dentizone.Infrastructure/Repositories/PostRepsitory.cs b/Dentizone.Infrastructure/Repositories/PostRepsitory.cs index 84ca4bb..3726648 100644 --- a/Dentizone.Infrastructure/Repositories/PostRepsitory.cs +++ b/Dentizone.Infrastructure/Repositories/PostRepsitory.cs @@ -10,15 +10,15 @@ internal class PostRepository(AppDbContext dbContext) : AbstractRepository(dbCon { public async Task CreateAsync(Post entity) { - await dbContext.Posts.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Posts.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.Posts; + IQueryable query = DbContext.Posts; if (includes != null) { foreach (var include in includes) @@ -40,15 +40,15 @@ public async Task CreateAsync(Post entity) } - dbContext.Posts.Remove(post); - await dbContext.SaveChangesAsync(); + DbContext.Posts.Remove(post); + await DbContext.SaveChangesAsync(); return post; } public async Task> GetAllAsync(int page) { int skippedPages = CalculatePagination(page); - return await dbContext.Posts + return await DbContext.Posts .Skip(skippedPages) .Take(DefaultPageSize) .ToListAsync(); @@ -58,7 +58,7 @@ public async Task> GetAllAsync(int page, Expression>? orderBy, Expression>[]? includes = null) { - IQueryable query = dbContext.Posts; + IQueryable query = DbContext.Posts; if (filter != null) { query = query.Where(filter); @@ -85,7 +85,7 @@ public IQueryable GetAllAsync(Expression>? filter, Expression>? orderBy = null, Expression>[]? includes = null) { - IQueryable query = dbContext.Posts; + IQueryable query = DbContext.Posts; if (filter != null) { query = query.Where(filter); @@ -109,7 +109,7 @@ public IQueryable GetAllAsync(Expression>? filter, public async Task GetByIdAsync(string id) { - return await dbContext.Posts + return await DbContext.Posts .Include(p => p.Seller) .Include(p => p.Category) .Include(p => p.SubCategory) @@ -121,8 +121,8 @@ public IQueryable GetAllAsync(Expression>? filter, public async Task UpdateAsync(Post entity) { - dbContext.Posts.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Posts.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } @@ -135,8 +135,8 @@ public async Task UpdatePostStatus(string postId, PostStatus status) } post.Status = status; - dbContext.Posts.Update(post); - await dbContext.SaveChangesAsync(); + DbContext.Posts.Update(post); + await DbContext.SaveChangesAsync(); } public async Task> SearchAsync(string? keyword, string? city, string? category, @@ -144,7 +144,7 @@ public async Task> SearchAsync(string? keyword, string? city, s decimal? minPrice, decimal? maxPrice, string? sortBy, bool sortDirection, int page) { - var posts = dbContext.Posts + var posts = DbContext.Posts .Where(p => !p.IsDeleted && p.Status == PostStatus.Active) .AsQueryable(); @@ -184,14 +184,14 @@ public async Task> SearchAsync(string? keyword, string? city, s public IQueryable GetActivePosts() { - var result = dbContext.Posts.AsNoTracking().Where(p => !p.IsDeleted && p.Status == PostStatus.Active); + var result = DbContext.Posts.AsNoTracking().Where(p => !p.IsDeleted && p.Status == PostStatus.Active); return result; } public IQueryable GetPendingPosts() { - return dbContext.Posts.AsNoTracking().Where(p => !p.IsDeleted && p.Status == PostStatus.Pending); + return DbContext.Posts.AsNoTracking().Where(p => !p.IsDeleted && p.Status == PostStatus.Pending); } public async Task AveragePostsPriceAsync() @@ -208,7 +208,7 @@ public async Task AveragePostsPriceAsync() public async Task> GetPostCountPerCategoryAsync() { - var result = await dbContext.Posts + var result = await DbContext.Posts .AsNoTracking() .Include(p => p.Category) .Where(p => !p.IsDeleted && !p.Category.IsDeleted) @@ -221,7 +221,7 @@ public async Task> GetPostCountPerCategoryAsync() public async Task> ValidatePostsByState(List postIds, PostStatus state) { - var posts = await dbContext.Posts + var posts = await DbContext.Posts .Where(p => postIds.Contains(p.Id) && p.Status == state) .Include(p => p.Seller) .ThenInclude(s => s.Wallet) diff --git a/Dentizone.Infrastructure/Repositories/QuestionRepository.cs b/Dentizone.Infrastructure/Repositories/QuestionRepository.cs index 6ea3580..500386b 100644 --- a/Dentizone.Infrastructure/Repositories/QuestionRepository.cs +++ b/Dentizone.Infrastructure/Repositories/QuestionRepository.cs @@ -9,15 +9,15 @@ internal class QuestionRepository(AppDbContext dbContext) : AbstractRepository(d { public async Task CreateAsync(Question entity) { - await dbContext.Questions.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Questions.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.Questions; + IQueryable query = DbContext.Questions; if (includes != null) { foreach (var include in includes) @@ -37,23 +37,23 @@ public async Task CreateAsync(Question entity) return null; } - dbContext.Questions.Remove(question); - await dbContext.SaveChangesAsync(); + DbContext.Questions.Remove(question); + await DbContext.SaveChangesAsync(); return question; } public async Task GetByIdAsync(string id) { - return await dbContext.Questions + return await DbContext.Questions .Include(p => p.Post) .Where(q => q.Id == id).FirstOrDefaultAsync(); } public async Task UpdateAsync(Question entity) { - dbContext.Questions.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Questions.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } @@ -61,7 +61,7 @@ public async Task UpdateAsync(Question entity) public async Task> FindAllBy(Expression> condition, Expression>[]? includes = null) { - IQueryable query = dbContext.Questions; + IQueryable query = DbContext.Questions; if (includes != null) { diff --git a/Dentizone.Infrastructure/Repositories/ReviewRepository.cs b/Dentizone.Infrastructure/Repositories/ReviewRepository.cs index 831558e..2f82a42 100644 --- a/Dentizone.Infrastructure/Repositories/ReviewRepository.cs +++ b/Dentizone.Infrastructure/Repositories/ReviewRepository.cs @@ -9,22 +9,22 @@ internal class ReviewRepository(AppDbContext dbContext) : AbstractRepository(dbC { public async Task GetByIdAsync(string id) { - return await dbContext.Reviews + return await DbContext.Reviews .FirstOrDefaultAsync(r => r.Id == id && !r.IsDeleted); } public async Task CreateAsync(Review entity) { - await dbContext.Reviews.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Reviews.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.Reviews; + IQueryable query = DbContext.Reviews; if (includes != null) { foreach (var include in includes) @@ -44,20 +44,20 @@ public async Task CreateAsync(Review entity) return null; } - dbContext.Reviews.Remove(toBeDeleted); + DbContext.Reviews.Remove(toBeDeleted); return toBeDeleted; } public async Task Update(Review entity) { - dbContext.Reviews.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Reviews.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } public IQueryable FindAllBy(Expression> condition) { - return dbContext.Reviews + return DbContext.Reviews .Where(condition).AsQueryable(); } } diff --git a/Dentizone.Infrastructure/Repositories/SaleTransactionRepository.cs b/Dentizone.Infrastructure/Repositories/SaleTransactionRepository.cs index e1b10a4..a418ab0 100644 --- a/Dentizone.Infrastructure/Repositories/SaleTransactionRepository.cs +++ b/Dentizone.Infrastructure/Repositories/SaleTransactionRepository.cs @@ -10,22 +10,22 @@ public class SaleTransactionRepository(AppDbContext dbContext) { public async Task GetByIdAsync(string id) { - return await dbContext.SalesTransactions + return await DbContext.SalesTransactions .FirstOrDefaultAsync(st => st.Id == id); } public async Task CreateAsync(SalesTransaction entity) { - await dbContext.SalesTransactions.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.SalesTransactions.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.SalesTransactions; + IQueryable query = DbContext.SalesTransactions; if (includes != null) { foreach (var include in includes) @@ -40,8 +40,8 @@ public async Task CreateAsync(SalesTransaction entity) public async Task UpdateAsync(SalesTransaction entity) { - dbContext.SalesTransactions.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.SalesTransactions.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/Repositories/ShipInfoRepository.cs b/Dentizone.Infrastructure/Repositories/ShipInfoRepository.cs index dd5abae..f521c18 100644 --- a/Dentizone.Infrastructure/Repositories/ShipInfoRepository.cs +++ b/Dentizone.Infrastructure/Repositories/ShipInfoRepository.cs @@ -9,22 +9,22 @@ internal class ShipInfoRepository(AppDbContext dbContext) : AbstractRepository(d { public async Task GetByIdAsync(string id) { - return await dbContext.ShipInfos + return await DbContext.ShipInfos .FirstOrDefaultAsync(s => s.Id == id); } public async Task CreateAsync(ShipInfo entity) { - await dbContext.ShipInfos.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.ShipInfos.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.ShipInfos; + IQueryable query = DbContext.ShipInfos; if (includes != null) { foreach (var include in includes) diff --git a/Dentizone.Infrastructure/Repositories/ShipmentActivityRepository.cs b/Dentizone.Infrastructure/Repositories/ShipmentActivityRepository.cs index 5221095..c76cb04 100644 --- a/Dentizone.Infrastructure/Repositories/ShipmentActivityRepository.cs +++ b/Dentizone.Infrastructure/Repositories/ShipmentActivityRepository.cs @@ -11,22 +11,22 @@ internal class ShipmentActivityRepository(AppDbContext dbContext) public async Task GetByIdAsync(string id) { return await - dbContext.ShipmentActivities + DbContext.ShipmentActivities .FirstOrDefaultAsync(s => s.Id == id); } public async Task CreateAsync(ShipmentActivity entity) { - await dbContext.ShipmentActivities.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.ShipmentActivities.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.ShipmentActivities; + IQueryable query = DbContext.ShipmentActivities; if (includes != null) { foreach (var include in includes) @@ -47,8 +47,8 @@ public async Task CreateAsync(ShipmentActivity entity) return null; } - dbContext.ShipmentActivities.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.ShipmentActivities.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } } diff --git a/Dentizone.Infrastructure/Repositories/SubCategoryRepository.cs b/Dentizone.Infrastructure/Repositories/SubCategoryRepository.cs index d7d6669..701f209 100644 --- a/Dentizone.Infrastructure/Repositories/SubCategoryRepository.cs +++ b/Dentizone.Infrastructure/Repositories/SubCategoryRepository.cs @@ -10,22 +10,22 @@ internal class SubCategoryRepository(AppDbContext dbContext) : AbstractRepositor { public async Task GetByIdAsync(string id) { - return await dbContext.SubCategories + return await DbContext.SubCategories .FirstOrDefaultAsync(sc => sc.Id == id); } public async Task CreateAsync(SubCategory entity) { - await dbContext.SubCategories.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.SubCategories.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.SubCategories; + IQueryable query = DbContext.SubCategories; if (includes != null) { foreach (var include in includes) @@ -46,23 +46,23 @@ public async Task CreateAsync(SubCategory entity) return null; } - dbContext.SubCategories.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.SubCategories.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } public async Task> GetAll() { - return await dbContext.SubCategories + return await DbContext.SubCategories .Include(sc => sc.Category) .ToListAsync(); } public async Task Update(SubCategory entity) { - dbContext.SubCategories.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.SubCategories.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } diff --git a/Dentizone.Infrastructure/Repositories/UniversityRepository.cs b/Dentizone.Infrastructure/Repositories/UniversityRepository.cs index 91f275e..ee69c59 100644 --- a/Dentizone.Infrastructure/Repositories/UniversityRepository.cs +++ b/Dentizone.Infrastructure/Repositories/UniversityRepository.cs @@ -10,21 +10,21 @@ internal class UniversityRepository(AppDbContext dbContext) : AbstractRepository { public async Task GetByIdAsync(string id) { - return await dbContext.Universities.Where(u => !u.IsDeleted).FirstOrDefaultAsync(u => u.Id == id); + return await DbContext.Universities.Where(u => !u.IsDeleted).FirstOrDefaultAsync(u => u.Id == id); } public async Task CreateAsync(University entity) { - await dbContext.Universities.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.Universities.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.Universities.Where(u => !u.IsDeleted); + IQueryable query = DbContext.Universities.Where(u => !u.IsDeleted); if (includes != null) { foreach (var include in includes) @@ -45,23 +45,23 @@ public async Task CreateAsync(University entity) return null; } - dbContext.Universities.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.Universities.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } public async Task Update(University entity) { - dbContext.Universities.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.Universities.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task> GetAll() { - return await dbContext.Universities + return await DbContext.Universities .Where(u => !u.IsDeleted) .OrderByDescending(u => u.CreatedAt) .AsNoTracking() @@ -70,7 +70,7 @@ public async Task> GetAll() public async Task> GetAll(int page, Expression>? filter) { - var query = dbContext.Universities.AsQueryable(); + var query = DbContext.Universities.AsQueryable(); query = query.Where(u => !u.IsDeleted) .OrderByDescending(u => u.CreatedAt); diff --git a/Dentizone.Infrastructure/Repositories/UserActivityRepository.cs b/Dentizone.Infrastructure/Repositories/UserActivityRepository.cs index 4dd2206..0cd79e8 100644 --- a/Dentizone.Infrastructure/Repositories/UserActivityRepository.cs +++ b/Dentizone.Infrastructure/Repositories/UserActivityRepository.cs @@ -9,22 +9,22 @@ public class UserActivityRepository(AppDbContext dbContext) : AbstractRepository { public async Task GetByIdAsync(string id) { - return await dbContext.UserActivities + return await DbContext.UserActivities .FirstOrDefaultAsync(u => u.Id == id); } public async Task CreateAsync(UserActivity entity) { - await dbContext.UserActivities.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.UserActivities.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.UserActivities; + IQueryable query = DbContext.UserActivities; if (includes != null) { foreach (var include in includes) @@ -38,7 +38,7 @@ public async Task CreateAsync(UserActivity entity) public async Task> GetAllBy(int page, Expression>? filter) { - IQueryable query = dbContext.UserActivities; + IQueryable query = DbContext.UserActivities; if (filter != null) { query = query.Where(filter); diff --git a/Dentizone.Infrastructure/Repositories/UserAssetRepository.cs b/Dentizone.Infrastructure/Repositories/UserAssetRepository.cs index 4f60058..348e898 100644 --- a/Dentizone.Infrastructure/Repositories/UserAssetRepository.cs +++ b/Dentizone.Infrastructure/Repositories/UserAssetRepository.cs @@ -9,22 +9,22 @@ internal class UserAssetRepository(AppDbContext dbContext) : AbstractRepository( { public async Task GetByIdAsync(string id) { - return await dbContext.UserAssets + return await DbContext.UserAssets .FirstOrDefaultAsync(u => u.Id == id && !u.IsDeleted); } public async Task CreateAsync(UserAsset entity) { - await dbContext.UserAssets.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.UserAssets.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.UserAssets.Where(u => !u.IsDeleted); + IQueryable query = DbContext.UserAssets.Where(u => !u.IsDeleted); if (includes != null) { foreach (var include in includes) @@ -44,14 +44,14 @@ public async Task CreateAsync(UserAsset entity) return null; } - dbContext.UserAssets.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.UserAssets.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } public async Task> GetAllByAsync(int page, Expression>? condition) { - IQueryable query = dbContext.UserAssets.Where(u => !u.IsDeleted); + IQueryable query = DbContext.UserAssets.Where(u => !u.IsDeleted); if (condition != null) { query = query.Where(condition); diff --git a/Dentizone.Infrastructure/Repositories/UserRepository.cs b/Dentizone.Infrastructure/Repositories/UserRepository.cs index 90cf087..0b77ecc 100644 --- a/Dentizone.Infrastructure/Repositories/UserRepository.cs +++ b/Dentizone.Infrastructure/Repositories/UserRepository.cs @@ -10,14 +10,14 @@ internal class UserRepository(AppDbContext dbContext) : AbstractRepository(dbCon public async Task GetByIdAsync(string id) { return await - dbContext.AppUsers + DbContext.AppUsers .FirstOrDefaultAsync(u => u.Id == id && !u.IsDeleted); } public async Task> GetAllAsync(int page = 1, Expression>? filter = null) { - var query = dbContext.AppUsers + var query = DbContext.AppUsers .Skip(CalculatePagination(page)) .Take(DefaultPageSize); @@ -31,15 +31,15 @@ public async Task> GetAllAsync(int page = 1, public async Task CreateAsync(AppUser entity) { - await dbContext.AppUsers.AddAsync(entity); - await dbContext.SaveChangesAsync(); + await DbContext.AppUsers.AddAsync(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = dbContext.AppUsers.Where(u => !u.IsDeleted); + IQueryable query = DbContext.AppUsers.Where(u => !u.IsDeleted); if (includes != null) { foreach (var include in includes) @@ -59,41 +59,41 @@ public async Task CreateAsync(AppUser entity) return null; } - dbContext.AppUsers.Remove(toBeDeleted); - await dbContext.SaveChangesAsync(); + DbContext.AppUsers.Remove(toBeDeleted); + await DbContext.SaveChangesAsync(); return toBeDeleted; } public async Task Update(AppUser entity) { - dbContext.AppUsers.Update(entity); - await dbContext.SaveChangesAsync(); + DbContext.AppUsers.Update(entity); + await DbContext.SaveChangesAsync(); return entity; } public async Task GetCountOfUsersAsync() { - var count = await dbContext.AppUsers.Where(u => !u.IsDeleted).CountAsync(); + var count = await DbContext.AppUsers.Where(u => !u.IsDeleted).CountAsync(); return count; } public async Task GetCount7DaysAsync() { - var count = await dbContext.AppUsers.Where(u => !u.IsDeleted && u.CreatedAt >= DateTime.UtcNow.AddDays(-7)) + var count = await DbContext.AppUsers.Where(u => !u.IsDeleted && u.CreatedAt >= DateTime.UtcNow.AddDays(-7)) .CountAsync(); return count; } public async Task GetCount30DaysAsync() { - var count = await dbContext.AppUsers.Where(u => !u.IsDeleted && u.CreatedAt >= DateTime.UtcNow.AddDays(-30)) + var count = await DbContext.AppUsers.Where(u => !u.IsDeleted && u.CreatedAt >= DateTime.UtcNow.AddDays(-30)) .CountAsync(); return count; } public async Task> GetStudentCountPerUniversityAsync() { - var result = await dbContext.AppUsers + var result = await DbContext.AppUsers .Where(a => !a.IsDeleted && a.University != null) .GroupBy(a => a.University.Name) .ToDictionaryAsync(g => g.Key, g => g.Count()); diff --git a/Dentizone.Infrastructure/Repositories/WalletRepository.cs b/Dentizone.Infrastructure/Repositories/WalletRepository.cs index 554c665..b1ce735 100644 --- a/Dentizone.Infrastructure/Repositories/WalletRepository.cs +++ b/Dentizone.Infrastructure/Repositories/WalletRepository.cs @@ -7,19 +7,19 @@ namespace Dentizone.Infrastructure.Repositories { public class WalletRepository(AppDbContext dbContext) : AbstractRepository(dbContext), IWalletRepository { - private AppDbContext DbContext = dbContext; + private AppDbContext _dbContext = dbContext; public async Task CreateAsync(Wallet entity) { - await DbContext.Wallets.AddAsync(entity); - await DbContext.SaveChangesAsync(); + await _dbContext.Wallets.AddAsync(entity); + await _dbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = DbContext.Wallets; + IQueryable query = _dbContext.Wallets; if (includes != null) { foreach (var include in includes) @@ -34,15 +34,15 @@ public async Task CreateAsync(Wallet entity) public async Task GetByIdAsync(string id) { - var wallet = await DbContext.Wallets.Where(w => w.Id == id) + var wallet = await _dbContext.Wallets.Where(w => w.Id == id) .FirstOrDefaultAsync(); return wallet; } public async Task UpdateAsync(Wallet entity) { - DbContext.Wallets.Update(entity); - await DbContext.SaveChangesAsync(); + _dbContext.Wallets.Update(entity); + await _dbContext.SaveChangesAsync(); return entity; } } diff --git a/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs b/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs index d030424..bdd1294 100644 --- a/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs +++ b/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs @@ -8,19 +8,19 @@ namespace Dentizone.Infrastructure.Repositories internal class WithdrawalRequestRepository(AppDbContext dbContext) : AbstractRepository(dbContext), IWithdrawalRequestRepository { - private AppDbContext DbContext = dbContext; + private AppDbContext _dbContext = dbContext; public async Task CreateAsync(WithdrawalRequest entity) { - await DbContext.WithdrawalRequests.AddAsync(entity); - await DbContext.SaveChangesAsync(); + await _dbContext.WithdrawalRequests.AddAsync(entity); + await _dbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = DbContext.WithdrawalRequests; + IQueryable query = _dbContext.WithdrawalRequests; if (includes != null) { foreach (var include in includes) @@ -35,7 +35,7 @@ public async Task CreateAsync(WithdrawalRequest entity) public async Task> GetAllAsync( int page, Expression>? condition) { - IQueryable query = DbContext.WithdrawalRequests; + IQueryable query = _dbContext.WithdrawalRequests; if (condition != null) { query = query.Where(condition); @@ -50,18 +50,18 @@ public async Task> GetAllAsync( public async Task DeleteAsync(string id) { - var deleted_request = await GetByIdAsync(id); - DbContext.WithdrawalRequests.Remove(deleted_request); + var deletedRequest = await GetByIdAsync(id); + _dbContext.WithdrawalRequests.Remove(deletedRequest); - await DbContext.SaveChangesAsync(); - return deleted_request; + await _dbContext.SaveChangesAsync(); + return deletedRequest; } public async Task GetByIdAsync(string id) { - var request = await DbContext.WithdrawalRequests.Where(w => w.Id == id) + var request = await _dbContext.WithdrawalRequests.Where(w => w.Id == id) .Include(w => w.Wallet) .Include(w => w.Wallet.User) .FirstOrDefaultAsync(); @@ -70,10 +70,10 @@ public async Task> GetAllAsync( public async Task UpdateAsync(WithdrawalRequest entity) { - DbContext.WithdrawalRequests.Update(entity); + _dbContext.WithdrawalRequests.Update(entity); - await DbContext.SaveChangesAsync(); + await _dbContext.SaveChangesAsync(); return entity; } diff --git a/Dentizone.Presentaion/Controllers/AnalyticsController.cs b/Dentizone.Presentaion/Controllers/AnalyticsController.cs index d0a2b35..e46e154 100644 --- a/Dentizone.Presentaion/Controllers/AnalyticsController.cs +++ b/Dentizone.Presentaion/Controllers/AnalyticsController.cs @@ -1,4 +1,4 @@ -using Dentizone.Application.Interfaces.Analytics; +using Dentizone.Application.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Dentizone.Presentaion/Controllers/AuthenticationController.cs b/Dentizone.Presentaion/Controllers/AuthenticationController.cs index 5f61acd..b55eeb2 100644 --- a/Dentizone.Presentaion/Controllers/AuthenticationController.cs +++ b/Dentizone.Presentaion/Controllers/AuthenticationController.cs @@ -29,7 +29,7 @@ public async Task Login([FromBody] LoginRequestDto loginPayload) var token = tokenService.GenerateAccessToken(loggedInUser.User.Id, loggedInUser.User.Email, - loggedInUser.role.ToString()); + loggedInUser.Role.ToString()); var refreshToken = tokenService.GenerateRefreshToken(loggedInUser.User.Id); return Ok(new RefreshTokenResponse() { @@ -48,7 +48,7 @@ public async Task Register([FromBody] RegisterRequestDto register FullName = registerPayloadDto.FullName, AcademicYear = registerPayloadDto.AcademicYear, UniversityId = registerPayloadDto.UniversityId, - KycStatus = KycStatus.PENDING, + KycStatus = KycStatus.Pending, Username = registerPayloadDto.Username, Status = UserState.PendingVerification, Id = loggedInUser.User.Id, // IdentityServer uses string IDs for users @@ -57,7 +57,7 @@ public async Task Register([FromBody] RegisterRequestDto register var userData = await userService.CreateAsync(userDataDto); var token = tokenService.GenerateAccessToken(loggedInUser.User.Id, registerPayloadDto.Email, - loggedInUser.role.ToString()); + loggedInUser.Role.ToString()); var refreshToken = tokenService.GenerateRefreshToken(loggedInUser.User.Id); return Ok(new RefreshTokenResponse() { diff --git a/Dentizone.Presentaion/Controllers/CartController.cs b/Dentizone.Presentaion/Controllers/CartController.cs index 3be8cd1..87720a4 100644 --- a/Dentizone.Presentaion/Controllers/CartController.cs +++ b/Dentizone.Presentaion/Controllers/CartController.cs @@ -1,5 +1,5 @@ using Dentizone.Application.DTOs.Cart; -using Dentizone.Application.Interfaces.Cart; +using Dentizone.Application.Interfaces; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using AuthorizeAttribute = Microsoft.AspNetCore.Authorization.AuthorizeAttribute; diff --git a/Dentizone.Presentaion/Controllers/CatalogController.cs b/Dentizone.Presentaion/Controllers/CatalogController.cs index 4235789..3e38910 100644 --- a/Dentizone.Presentaion/Controllers/CatalogController.cs +++ b/Dentizone.Presentaion/Controllers/CatalogController.cs @@ -1,5 +1,5 @@ using Dentizone.Application.DTOs.Catalog; -using Dentizone.Application.Interfaces.Catalog; +using Dentizone.Application.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Dentizone.Presentaion/Controllers/FavoritesController.cs b/Dentizone.Presentaion/Controllers/FavoritesController.cs index 69b566e..126f0c5 100644 --- a/Dentizone.Presentaion/Controllers/FavoritesController.cs +++ b/Dentizone.Presentaion/Controllers/FavoritesController.cs @@ -1,5 +1,5 @@ using Dentizone.Application.DTOs.Favorites; -using Dentizone.Application.Interfaces.Favorites; +using Dentizone.Application.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; diff --git a/Dentizone.Presentaion/Controllers/OrderController.cs b/Dentizone.Presentaion/Controllers/OrderController.cs index bde7143..7f3dd7c 100644 --- a/Dentizone.Presentaion/Controllers/OrderController.cs +++ b/Dentizone.Presentaion/Controllers/OrderController.cs @@ -1,5 +1,4 @@ using Dentizone.Application.DTOs.Order; -using Dentizone.Application.Interfaces.Order; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; diff --git a/Dentizone.Presentaion/Controllers/PostsController.cs b/Dentizone.Presentaion/Controllers/PostsController.cs index 7c5b6df..50ea64c 100644 --- a/Dentizone.Presentaion/Controllers/PostsController.cs +++ b/Dentizone.Presentaion/Controllers/PostsController.cs @@ -1,9 +1,9 @@ -using Dentizone.Application.DTOs.PostDTO; -using Dentizone.Application.DTOs.PostFilterDTO; -using Dentizone.Application.Interfaces.Post; +using Dentizone.Application.DTOs.PostFilterDTO; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; +using Dentizone.Application.DTOs.Post; +using Dentizone.Application.Interfaces; namespace Dentizone.Presentaion.Controllers { @@ -71,9 +71,9 @@ public async Task GetSidebarFilter() [AllowAnonymous] [HttpGet("search")] - public async Task Search([FromQuery] UserPreferenceDto userPreferenceDTO) + public async Task Search([FromQuery] UserPreferenceDto userPreferenceDto) { - var searchResult = await postService.Search(userPreferenceDTO); + var searchResult = await postService.Search(userPreferenceDto); return Ok(searchResult); } } diff --git a/Dentizone.Presentaion/Controllers/QAController.cs b/Dentizone.Presentaion/Controllers/QAController.cs index bdf6dd2..a408a9a 100644 --- a/Dentizone.Presentaion/Controllers/QAController.cs +++ b/Dentizone.Presentaion/Controllers/QAController.cs @@ -13,20 +13,20 @@ namespace Dentizone.Presentaion.Controllers [Route("api/[controller]")] [ApiController] [Authorize] - public class QAController(IQAService QAService) : ControllerBase + public class QaController(IQaService qaService) : ControllerBase { [HttpPost()] public async Task AskQuestion([FromBody] CreateQuestionDto dto) { var userId = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; - var question = await QAService.AskQuestionAsync(dto, userId); + var question = await qaService.AskQuestionAsync(dto, userId); return Ok(question); } [HttpGet("questions/{postId}")] public async Task GetQuestionsForPost(string postId) { - var questions = await QAService.GetQuestionsForPostAsync(postId); + var questions = await qaService.GetQuestionsForPostAsync(postId); return Ok(questions); } @@ -35,35 +35,35 @@ public async Task AnswerQuestion(string questionId, [FromBody] Cr { var responderId = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; - var answer = await QAService.AnswerQuestionAsync(questionId, dto, responderId); + var answer = await qaService.AnswerQuestionAsync(questionId, dto, responderId); return Ok(answer); } [HttpPut("{questionId}")] public async Task UpdateQuestion(string questionId, [FromBody] UpdateQuestionDto dto) { - await QAService.UpdateQuestionAsync(questionId, dto); + await qaService.UpdateQuestionAsync(questionId, dto); return NoContent(); } [HttpDelete("{questionId}")] public async Task DeleteQuestion(string questionId) { - await QAService.DeleteQuestionAsync(questionId); + await qaService.DeleteQuestionAsync(questionId); return NoContent(); } [HttpPut("answers/{answerId}")] public async Task UpdateAnswer(string answerId, [FromBody] UpdateAnswerDto dto) { - await QAService.UpdateAnswerAsync(answerId, dto); + await qaService.UpdateAnswerAsync(answerId, dto); return NoContent(); } [HttpDelete("answers/{answerId}")] public async Task DeleteAnswer(string answerId) { - await QAService.DeleteAnswerAsync(answerId); + await qaService.DeleteAnswerAsync(answerId); return NoContent(); } } diff --git a/Dentizone.Presentaion/Controllers/ReviewController.cs b/Dentizone.Presentaion/Controllers/ReviewController.cs index d1baf3d..0038c8d 100644 --- a/Dentizone.Presentaion/Controllers/ReviewController.cs +++ b/Dentizone.Presentaion/Controllers/ReviewController.cs @@ -1,6 +1,6 @@ using System.Security.Claims; using Dentizone.Application.DTOs.Review; -using Dentizone.Application.Interfaces.Review; +using Dentizone.Application.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Dentizone.Presentaion/Controllers/ShippingController.cs b/Dentizone.Presentaion/Controllers/ShippingController.cs index 30cff36..90980c2 100644 --- a/Dentizone.Presentaion/Controllers/ShippingController.cs +++ b/Dentizone.Presentaion/Controllers/ShippingController.cs @@ -1,4 +1,4 @@ -using Dentizone.Application.Interfaces.Order; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Enums; using Dentizone.Domain.Interfaces.Repositories; using Microsoft.AspNetCore.Authorization; diff --git a/Dentizone.Presentaion/Controllers/UsersController.cs b/Dentizone.Presentaion/Controllers/UsersController.cs index 8d038db..10ce1ac 100644 --- a/Dentizone.Presentaion/Controllers/UsersController.cs +++ b/Dentizone.Presentaion/Controllers/UsersController.cs @@ -93,7 +93,7 @@ public async Task SetKycStatus(string id, [FromBody] KycStatus st } [HttpPatch("{id}/state")] - public async Task SetUserState(string id, [FromBody] UserStateDTO userStateDto) + public async Task SetUserState(string id, [FromBody] UserStateDto userStateDto) { try { diff --git a/Dentizone.Presentaion/Controllers/VerificationController.cs b/Dentizone.Presentaion/Controllers/VerificationController.cs index 409a009..985a507 100644 --- a/Dentizone.Presentaion/Controllers/VerificationController.cs +++ b/Dentizone.Presentaion/Controllers/VerificationController.cs @@ -33,15 +33,15 @@ public async Task StartVerification() // Check if the user already verified var user = await userService.GetByIdAsync(userId); - if (user.KycStatus.Equals(KycStatus.PENDING.ToString(), StringComparison.OrdinalIgnoreCase) || - user.KycStatus.Equals(KycStatus.APPROVED.ToString(), StringComparison.OrdinalIgnoreCase)) + if (user.KycStatus.Equals(KycStatus.Pending.ToString(), StringComparison.OrdinalIgnoreCase) || + user.KycStatus.Equals(KycStatus.Approved.ToString(), StringComparison.OrdinalIgnoreCase)) { return BadRequest("KYC process already in progress or completed."); } var session = await verificationService.StartSessionAsync(userId); - await userService.SetKycStatusAsync(user.Id, KycStatus.NOT_SUBMITTED); + await userService.SetKycStatusAsync(user.Id, KycStatus.NotSubmitted); return Ok(session); } @@ -99,12 +99,12 @@ public async Task AlertWebhook() switch (verification.Status.ToLower()) { case "approved": - await authService.AlternateUserRoleAsync(UserRoles.VERIFIED, userId); + await authService.AlternateUserRoleAsync(UserRoles.Verified, userId); await verificationService.UpdateUserNationalId(userId, verification.IdVerification.PersonalNumber); break; case "declined": - await authService.AlternateUserRoleAsync(UserRoles.BLACKLISTED, userId); + await authService.AlternateUserRoleAsync(UserRoles.Blacklisted, userId); break; default: diff --git a/Dentizone.Presentaion/Controllers/WalletController.cs b/Dentizone.Presentaion/Controllers/WalletController.cs index eee6b64..e9379de 100644 --- a/Dentizone.Presentaion/Controllers/WalletController.cs +++ b/Dentizone.Presentaion/Controllers/WalletController.cs @@ -25,9 +25,9 @@ public async Task GetWalletBalance() [HttpPost("withdraw")] public async Task RequestWithdrawal([FromBody] WithdrawalRequestDto withdrawalRequestDto) { - var UserId = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; + var userId = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; - var request = await withdrawalService.CreateWithdrawalRequestAsync(UserId, withdrawalRequestDto); + var request = await withdrawalService.CreateWithdrawalRequestAsync(userId, withdrawalRequestDto); return Ok(request); } From 4f84ccfadba8bff8c25368f0ea108433a75b35f9 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 21:08:09 +0300 Subject: [PATCH 2/9] Refactor imports and update AssemblyReference structure - Replaced `AssemblyReference` class with `IAssemblyReference` interface in `AssemblyReference.cs`. - Removed unnecessary imports from multiple files, including `Services.cs`, `OrderService.cs`, and various controllers. - Updated import paths for DTOs in `PostService.cs` and `OrderService.cs`. - Streamlined using directives in `GUIDValidator.cs` and `Program.cs`. --- Dentizone.Application/AssemblyReference.cs | 2 +- Dentizone.Application/DI/Services.cs | 1 - Dentizone.Application/Services/OrderService.cs | 2 +- Dentizone.Application/Services/PostService.cs | 2 +- Dentizone.Application/Services/ReviewService.cs | 2 +- Dentizone.Application/Services/UploadService.cs | 1 - Dentizone.Application/Validators/GUIDValidator.cs | 7 +------ .../Controllers/AuthenticationController.cs | 1 - Dentizone.Presentaion/Controllers/OrderController.cs | 1 + Dentizone.Presentaion/Controllers/PostsController.cs | 4 ++-- Dentizone.Presentaion/Controllers/QAController.cs | 5 +---- Dentizone.Presentaion/Controllers/ShippingController.cs | 2 -- Dentizone.Presentaion/Controllers/UsersController.cs | 1 - .../Controllers/VerificationController.cs | 1 - Dentizone.Presentaion/Program.cs | 3 --- 15 files changed, 9 insertions(+), 26 deletions(-) diff --git a/Dentizone.Application/AssemblyReference.cs b/Dentizone.Application/AssemblyReference.cs index 9d5c46b..58a1b1e 100644 --- a/Dentizone.Application/AssemblyReference.cs +++ b/Dentizone.Application/AssemblyReference.cs @@ -1,6 +1,6 @@ namespace Dentizone.Application { - public static class AssemblyReference + public interface IAssemblyReference { } } \ No newline at end of file diff --git a/Dentizone.Application/DI/Services.cs b/Dentizone.Application/DI/Services.cs index addbaa5..83a23f7 100644 --- a/Dentizone.Application/DI/Services.cs +++ b/Dentizone.Application/DI/Services.cs @@ -1,5 +1,4 @@ using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.User; using Dentizone.Application.Services; using Dentizone.Application.Services.Authentication; using Dentizone.Application.Services.Payment; diff --git a/Dentizone.Application/Services/OrderService.cs b/Dentizone.Application/Services/OrderService.cs index 465d398..da2ca0f 100644 --- a/Dentizone.Application/Services/OrderService.cs +++ b/Dentizone.Application/Services/OrderService.cs @@ -2,7 +2,6 @@ using Dentizone.Application.DTOs; using Dentizone.Application.DTOs.Order; using Dentizone.Application.Interfaces; -using Dentizone.Application.Services.Payment; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; @@ -10,6 +9,7 @@ using Dentizone.Domain.Interfaces.Repositories; using Dentizone.Infrastructure; using System.Linq.Expressions; +using Dentizone.Application.DTOs.Payment; using Microsoft.AspNetCore.Http; namespace Dentizone.Application.Services diff --git a/Dentizone.Application/Services/PostService.cs b/Dentizone.Application/Services/PostService.cs index 3156956..03418d5 100644 --- a/Dentizone.Application/Services/PostService.cs +++ b/Dentizone.Application/Services/PostService.cs @@ -1,6 +1,6 @@ using AutoMapper; using Dentizone.Application.DTOs.Post; -using Dentizone.Application.DTOs.PostFilterDTO; +using Dentizone.Application.DTOs.Post.PostFilterDto; using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Enums; diff --git a/Dentizone.Application/Services/ReviewService.cs b/Dentizone.Application/Services/ReviewService.cs index d15e150..e68db0b 100644 --- a/Dentizone.Application/Services/ReviewService.cs +++ b/Dentizone.Application/Services/ReviewService.cs @@ -1,6 +1,6 @@ using AutoMapper; using Dentizone.Application.DTOs.Review; -using Dentizone.Application.Interfaces.Review; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Entity; using Dentizone.Domain.Interfaces.Repositories; using Dentizone.Domain.Exceptions; diff --git a/Dentizone.Application/Services/UploadService.cs b/Dentizone.Application/Services/UploadService.cs index 5fd2035..611938a 100644 --- a/Dentizone.Application/Services/UploadService.cs +++ b/Dentizone.Application/Services/UploadService.cs @@ -1,6 +1,5 @@ using Dentizone.Application.DTOs.Assets; using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.Cloudinary; using Dentizone.Domain.Enums; using Dentizone.Domain.Exceptions; using Microsoft.AspNetCore.Http; diff --git a/Dentizone.Application/Validators/GUIDValidator.cs b/Dentizone.Application/Validators/GUIDValidator.cs index fdd630b..1006b63 100644 --- a/Dentizone.Application/Validators/GUIDValidator.cs +++ b/Dentizone.Application/Validators/GUIDValidator.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FluentValidation; +using FluentValidation; namespace Dentizone.Application.Validators { diff --git a/Dentizone.Presentaion/Controllers/AuthenticationController.cs b/Dentizone.Presentaion/Controllers/AuthenticationController.cs index b55eeb2..29b7126 100644 --- a/Dentizone.Presentaion/Controllers/AuthenticationController.cs +++ b/Dentizone.Presentaion/Controllers/AuthenticationController.cs @@ -1,7 +1,6 @@ using Dentizone.Application.DTOs.Auth; using Dentizone.Application.DTOs.User; using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.User; using Dentizone.Domain.Enums; using Dentizone.Domain.Interfaces; using Microsoft.AspNetCore.Authorization; diff --git a/Dentizone.Presentaion/Controllers/OrderController.cs b/Dentizone.Presentaion/Controllers/OrderController.cs index 7f3dd7c..baf557a 100644 --- a/Dentizone.Presentaion/Controllers/OrderController.cs +++ b/Dentizone.Presentaion/Controllers/OrderController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; +using Dentizone.Application.Interfaces; namespace Dentizone.Presentaion.Controllers diff --git a/Dentizone.Presentaion/Controllers/PostsController.cs b/Dentizone.Presentaion/Controllers/PostsController.cs index 50ea64c..ed401fa 100644 --- a/Dentizone.Presentaion/Controllers/PostsController.cs +++ b/Dentizone.Presentaion/Controllers/PostsController.cs @@ -1,8 +1,8 @@ -using Dentizone.Application.DTOs.PostFilterDTO; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using Dentizone.Application.DTOs.Post; +using Dentizone.Application.DTOs.Post.PostFilterDto; using Dentizone.Application.Interfaces; namespace Dentizone.Presentaion.Controllers diff --git a/Dentizone.Presentaion/Controllers/QAController.cs b/Dentizone.Presentaion/Controllers/QAController.cs index a408a9a..c48a7fa 100644 --- a/Dentizone.Presentaion/Controllers/QAController.cs +++ b/Dentizone.Presentaion/Controllers/QAController.cs @@ -1,11 +1,8 @@ -using System.Runtime.CompilerServices; -using System.Security.Claims; +using System.Security.Claims; using Dentizone.Application.DTOs.Q_A.AnswerDTO; using Dentizone.Application.DTOs.Q_A.QuestionDTO; using Dentizone.Application.Interfaces; -using Dentizone.Application.Services; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace Dentizone.Presentaion.Controllers diff --git a/Dentizone.Presentaion/Controllers/ShippingController.cs b/Dentizone.Presentaion/Controllers/ShippingController.cs index 90980c2..8088b8d 100644 --- a/Dentizone.Presentaion/Controllers/ShippingController.cs +++ b/Dentizone.Presentaion/Controllers/ShippingController.cs @@ -1,8 +1,6 @@ using Dentizone.Application.Interfaces; using Dentizone.Domain.Enums; -using Dentizone.Domain.Interfaces.Repositories; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace Dentizone.Presentaion.Controllers diff --git a/Dentizone.Presentaion/Controllers/UsersController.cs b/Dentizone.Presentaion/Controllers/UsersController.cs index 10ce1ac..928bc2b 100644 --- a/Dentizone.Presentaion/Controllers/UsersController.cs +++ b/Dentizone.Presentaion/Controllers/UsersController.cs @@ -1,5 +1,4 @@ using Dentizone.Application.DTOs.User; -using Dentizone.Application.Interfaces.User; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; diff --git a/Dentizone.Presentaion/Controllers/VerificationController.cs b/Dentizone.Presentaion/Controllers/VerificationController.cs index 985a507..b7c14e6 100644 --- a/Dentizone.Presentaion/Controllers/VerificationController.cs +++ b/Dentizone.Presentaion/Controllers/VerificationController.cs @@ -1,5 +1,4 @@ using Dentizone.Application.Interfaces; -using Dentizone.Application.Interfaces.User; using Dentizone.Application.Services.Authentication; using Dentizone.Domain.Enums; using Microsoft.AspNetCore.Authorization; diff --git a/Dentizone.Presentaion/Program.cs b/Dentizone.Presentaion/Program.cs index a0a3e62..a35da8f 100644 --- a/Dentizone.Presentaion/Program.cs +++ b/Dentizone.Presentaion/Program.cs @@ -1,13 +1,10 @@ using Dentizone.Application.DI; using Dentizone.Application.Interfaces; -using Dentizone.Infrastructure; using Dentizone.Infrastructure.DependencyInjection; using Dentizone.Infrastructure.Filters; -using Dentizone.Infrastructure.Identity; using Dentizone.Presentaion.Context; using Dentizone.Presentaion.Extensions; using Dentizone.Presentaion.Middlewares; -using Microsoft.AspNetCore.Identity; using Scalar.AspNetCore; namespace Dentizone.Presentaion From 2333c44ecedd6ba0ac07091a1f12b1691c1be067 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 21:20:34 +0300 Subject: [PATCH 3/9] Add cache invalidation after post update Implement cache invalidation logic in PostService.cs to refresh the "SidebarFilter" cache after updating a post. This ensures data consistency by clearing stale cached data. --- Dentizone.Application/Services/PostService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dentizone.Application/Services/PostService.cs b/Dentizone.Application/Services/PostService.cs index 03418d5..61b5ec1 100644 --- a/Dentizone.Application/Services/PostService.cs +++ b/Dentizone.Application/Services/PostService.cs @@ -119,6 +119,10 @@ public async Task CreatePost(CreatePostDto createPostDto, string us await repo.UpdateAsync(post); await transaction.CommitAsync(); + // Invalidate The Cache + var cacheKey = CacheHelper.GenerateCacheKey("SidebarFilter"); + await redisService.InvalidateCache(cacheKey); + return mapper.Map(post); } catch From 871863d4c21004a378d1fb92e43cd2a8a78598b9 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 21:37:30 +0300 Subject: [PATCH 4/9] Add shipment activity repository and refactor dbContext usage - Introduced `IShipmentActivityRepository` in `AddRepositories.cs`. - Removed private `_dbContext` field in `WalletRepository.cs` and `WithdrawalRequestRepository.cs`, using constructor parameter `dbContext` instead. - Added a using directive for `Dentizone.Application.Interfaces` in `UsersController.cs`. - Updated AutoMapper assembly reference in `Program.cs` from `Application.AssemblyReference` to `Application.IAssemblyReference`. --- .../DependencyInjection/AddRepositories.cs | 1 + .../Repositories/WalletRepository.cs | 14 ++++++------- .../WithdrawalRequestRepository.cs | 20 +++++++++---------- .../Controllers/UsersController.cs | 1 + Dentizone.Presentaion/Program.cs | 2 +- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Dentizone.Infrastructure/DependencyInjection/AddRepositories.cs b/Dentizone.Infrastructure/DependencyInjection/AddRepositories.cs index 1d863bd..f36b667 100644 --- a/Dentizone.Infrastructure/DependencyInjection/AddRepositories.cs +++ b/Dentizone.Infrastructure/DependencyInjection/AddRepositories.cs @@ -22,6 +22,7 @@ public static IServiceCollection AddRepositories(this IServiceCollection service services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/Dentizone.Infrastructure/Repositories/WalletRepository.cs b/Dentizone.Infrastructure/Repositories/WalletRepository.cs index b1ce735..6ae699b 100644 --- a/Dentizone.Infrastructure/Repositories/WalletRepository.cs +++ b/Dentizone.Infrastructure/Repositories/WalletRepository.cs @@ -7,19 +7,17 @@ namespace Dentizone.Infrastructure.Repositories { public class WalletRepository(AppDbContext dbContext) : AbstractRepository(dbContext), IWalletRepository { - private AppDbContext _dbContext = dbContext; - public async Task CreateAsync(Wallet entity) { - await _dbContext.Wallets.AddAsync(entity); - await _dbContext.SaveChangesAsync(); + await dbContext.Wallets.AddAsync(entity); + await dbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = _dbContext.Wallets; + IQueryable query = dbContext.Wallets; if (includes != null) { foreach (var include in includes) @@ -34,15 +32,15 @@ public async Task CreateAsync(Wallet entity) public async Task GetByIdAsync(string id) { - var wallet = await _dbContext.Wallets.Where(w => w.Id == id) + var wallet = await dbContext.Wallets.Where(w => w.Id == id) .FirstOrDefaultAsync(); return wallet; } public async Task UpdateAsync(Wallet entity) { - _dbContext.Wallets.Update(entity); - await _dbContext.SaveChangesAsync(); + dbContext.Wallets.Update(entity); + await dbContext.SaveChangesAsync(); return entity; } } diff --git a/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs b/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs index bdd1294..7e34045 100644 --- a/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs +++ b/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs @@ -8,19 +8,17 @@ namespace Dentizone.Infrastructure.Repositories internal class WithdrawalRequestRepository(AppDbContext dbContext) : AbstractRepository(dbContext), IWithdrawalRequestRepository { - private AppDbContext _dbContext = dbContext; - public async Task CreateAsync(WithdrawalRequest entity) { - await _dbContext.WithdrawalRequests.AddAsync(entity); - await _dbContext.SaveChangesAsync(); + await dbContext.WithdrawalRequests.AddAsync(entity); + await dbContext.SaveChangesAsync(); return entity; } public async Task FindBy(Expression> condition, Expression>[]? includes) { - IQueryable query = _dbContext.WithdrawalRequests; + IQueryable query = dbContext.WithdrawalRequests; if (includes != null) { foreach (var include in includes) @@ -35,7 +33,7 @@ public async Task CreateAsync(WithdrawalRequest entity) public async Task> GetAllAsync( int page, Expression>? condition) { - IQueryable query = _dbContext.WithdrawalRequests; + IQueryable query = dbContext.WithdrawalRequests; if (condition != null) { query = query.Where(condition); @@ -51,17 +49,17 @@ public async Task> GetAllAsync( public async Task DeleteAsync(string id) { var deletedRequest = await GetByIdAsync(id); - _dbContext.WithdrawalRequests.Remove(deletedRequest); + dbContext.WithdrawalRequests.Remove(deletedRequest); - await _dbContext.SaveChangesAsync(); + await dbContext.SaveChangesAsync(); return deletedRequest; } public async Task GetByIdAsync(string id) { - var request = await _dbContext.WithdrawalRequests.Where(w => w.Id == id) + var request = await dbContext.WithdrawalRequests.Where(w => w.Id == id) .Include(w => w.Wallet) .Include(w => w.Wallet.User) .FirstOrDefaultAsync(); @@ -70,10 +68,10 @@ public async Task> GetAllAsync( public async Task UpdateAsync(WithdrawalRequest entity) { - _dbContext.WithdrawalRequests.Update(entity); + dbContext.WithdrawalRequests.Update(entity); - await _dbContext.SaveChangesAsync(); + await dbContext.SaveChangesAsync(); return entity; } diff --git a/Dentizone.Presentaion/Controllers/UsersController.cs b/Dentizone.Presentaion/Controllers/UsersController.cs index 928bc2b..1895875 100644 --- a/Dentizone.Presentaion/Controllers/UsersController.cs +++ b/Dentizone.Presentaion/Controllers/UsersController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; +using Dentizone.Application.Interfaces; using Dentizone.Domain.Enums; namespace Dentizone.Presentaion.Controllers diff --git a/Dentizone.Presentaion/Program.cs b/Dentizone.Presentaion/Program.cs index a35da8f..7de393f 100644 --- a/Dentizone.Presentaion/Program.cs +++ b/Dentizone.Presentaion/Program.cs @@ -21,7 +21,7 @@ public static void Main(string[] args) // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi builder.Services.AddOpenApi(); builder.Services.AddInfrastructure(); - builder.Services.AddAutoMapper(typeof(Application.AssemblyReference).Assembly); + builder.Services.AddAutoMapper(typeof(Application.IAssemblyReference).Assembly); builder.Services.AddApplicationServices(); builder.Services.AddCors(c => From d5c5a6531788c74f6341cd271e915c192aebe756 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 21:39:08 +0300 Subject: [PATCH 5/9] Update migrations for order review tracking - Added `IsReviewed` column to `Orders` table. - Renamed `OrderId` to `ItemId` in `ShipmentActivities` and updated foreign key to reference `OrderItems`. - Regenerated `AppDbContextModelSnapshot` and migration designer files. - Updated `Down` methods to ensure proper rollback of changes. --- .../20250624175457_OptmizeOrder2.Designer.cs | 1694 ---------------- .../20250624175457_OptmizeOrder2.cs | 116 -- .../20250624175713_OptmizeOrder.Designer.cs | 1697 ---------------- .../Migrations/20250624175713_OptmizeOrder.cs | 29 - .../Migrations/20250626085204_M.Designer.cs | 1700 ----------------- .../Migrations/20250626085204_M.cs | 60 - .../Migrations/AppDbContextModelSnapshot.cs | 1697 ---------------- 7 files changed, 6993 deletions(-) delete mode 100644 Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.Designer.cs delete mode 100644 Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.cs delete mode 100644 Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.Designer.cs delete mode 100644 Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.cs delete mode 100644 Dentizone.Infrastructure/Migrations/20250626085204_M.Designer.cs delete mode 100644 Dentizone.Infrastructure/Migrations/20250626085204_M.cs delete mode 100644 Dentizone.Infrastructure/Migrations/AppDbContextModelSnapshot.cs diff --git a/Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.Designer.cs b/Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.Designer.cs deleted file mode 100644 index 335c8f6..0000000 --- a/Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.Designer.cs +++ /dev/null @@ -1,1694 +0,0 @@ -// -using System; -using Dentizone.Infrastructure; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250624175457_OptmizeOrder2")] - partial class OptmizeOrder2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("QuestionId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId") - .IsUnique(); - - b.ToTable("Answers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AcademicYear") - .HasColumnType("int"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("KycStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NationalId") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UniversityId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("Username") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("UniversityId"); - - b.ToTable("AppUsers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Size") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Active"); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("nvarchar(2048)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Assets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Carts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IconUrl") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Favourites"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CommissionAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("TotalAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("PostId"); - - b.ToTable("OrderItems"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderPickups"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Comment") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderStatuses"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Method") - .HasColumnType("int"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("OrderId"); - - b.ToTable("Payments"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Condition") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(-1) - .HasColumnType("nvarchar(max)"); - - b.Property("ExpireDate") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Price") - .HasColumnType("decimal(18,2)"); - - b.Property("SellerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubCategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SellerId"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("Posts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("PostId"); - - b.ToTable("PostAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AskerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AskerId"); - - b.HasIndex("PostId"); - - b.ToTable("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .HasColumnType("int"); - - b.Property("Text") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("Reviews"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(5); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("PENDING"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ReviewUxes"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PaymentId"); - - b.HasIndex("WalletId"); - - b.ToTable("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ShipInfos"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityDescription") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Domain") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("nvarchar(48)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsSupported") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("Universities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("DetectedAt") - .HasColumnType("datetime2"); - - b.Property("Device") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FingerprintToken") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("nvarchar(45)"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("UserId"); - - b.ToTable("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Balance") - .HasColumnType("decimal(18, 4)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("Wallets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AdminNotes") - .HasColumnType("text"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ProcessingFee") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(18,2)") - .HasDefaultValue(0.0m); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("WalletId"); - - b.ToTable("WithdrawalRequests", (string)null); - }); - - modelBuilder.Entity("Dentizone.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.HasOne("Dentizone.Domain.Entity.Question", "Question") - .WithOne("Answer") - .HasForeignKey("Dentizone.Domain.Entity.Answer", "QuestionId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Question"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.HasOne("Dentizone.Domain.Entity.University", "University") - .WithMany("Users") - .HasForeignKey("UniversityId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Carts") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Carts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Favourites") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Favourites") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Orders") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Buyer"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany() - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderPickups") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderStatuses") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Payments") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany() - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Buyer"); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "Seller") - .WithMany("Posts") - .HasForeignKey("SellerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Seller"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("PostAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("PostAssets") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Asset"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Questions") - .HasForeignKey("AskerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Questions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("Review") - .HasForeignKey("Dentizone.Domain.Entity.Review", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Reviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ReviewUx") - .HasForeignKey("Dentizone.Domain.Entity.ReviewUx", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UXReviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.HasOne("Dentizone.Domain.Entity.Payment", "Payment") - .WithMany("SalesTransactions") - .HasForeignKey("PaymentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("SalesTransactions") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Payment"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ShipInfo") - .HasForeignKey("Dentizone.Domain.Entity.ShipInfo", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("ShippingAddresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("ShipmentActivities") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserActivities") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("UserAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserAssets") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Asset"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithOne("Wallet") - .HasForeignKey("Dentizone.Domain.Entity.Wallet", "UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("WithdrawalRequests") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("Orders"); - - b.Navigation("Payments"); - - b.Navigation("Posts"); - - b.Navigation("Questions"); - - b.Navigation("Reviews"); - - b.Navigation("ShippingAddresses"); - - b.Navigation("UXReviews"); - - b.Navigation("UserActivities"); - - b.Navigation("UserAssets"); - - b.Navigation("Wallet") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Navigation("PostAssets"); - - b.Navigation("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Navigation("OrderItems"); - - b.Navigation("OrderPickups"); - - b.Navigation("OrderStatuses"); - - b.Navigation("Review") - .IsRequired(); - - b.Navigation("ReviewUx") - .IsRequired(); - - b.Navigation("ShipInfo") - .IsRequired(); - - b.Navigation("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Navigation("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("PostAssets"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Navigation("Answer") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Navigation("SalesTransactions"); - - b.Navigation("WithdrawalRequests"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.cs b/Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.cs deleted file mode 100644 index a671523..0000000 --- a/Dentizone.Infrastructure/Migrations/20250624175457_OptmizeOrder2.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - /// - public partial class OptmizeOrder2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Answers"); - - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "Carts"); - - migrationBuilder.DropTable( - name: "Favourites"); - - migrationBuilder.DropTable( - name: "OrderItems"); - - migrationBuilder.DropTable( - name: "OrderPickups"); - - migrationBuilder.DropTable( - name: "OrderStatuses"); - - migrationBuilder.DropTable( - name: "PostAssets"); - - migrationBuilder.DropTable( - name: "Reviews"); - - migrationBuilder.DropTable( - name: "ReviewUxes"); - - migrationBuilder.DropTable( - name: "SalesTransactions"); - - migrationBuilder.DropTable( - name: "ShipInfos"); - - migrationBuilder.DropTable( - name: "ShipmentActivities"); - - migrationBuilder.DropTable( - name: "UserActivities"); - - migrationBuilder.DropTable( - name: "UserAssets"); - - migrationBuilder.DropTable( - name: "WithdrawalRequests"); - - migrationBuilder.DropTable( - name: "Questions"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - - migrationBuilder.DropTable( - name: "Payments"); - - migrationBuilder.DropTable( - name: "Assets"); - - migrationBuilder.DropTable( - name: "Wallets"); - - migrationBuilder.DropTable( - name: "Posts"); - - migrationBuilder.DropTable( - name: "Orders"); - - migrationBuilder.DropTable( - name: "SubCategories"); - - migrationBuilder.DropTable( - name: "AppUsers"); - - migrationBuilder.DropTable( - name: "Categories"); - - migrationBuilder.DropTable( - name: "Universities"); - } - } -} diff --git a/Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.Designer.cs b/Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.Designer.cs deleted file mode 100644 index b5cc921..0000000 --- a/Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.Designer.cs +++ /dev/null @@ -1,1697 +0,0 @@ -// -using System; -using Dentizone.Infrastructure; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250624175713_OptmizeOrder")] - partial class OptmizeOrder - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("QuestionId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId") - .IsUnique(); - - b.ToTable("Answers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AcademicYear") - .HasColumnType("int"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("KycStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NationalId") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UniversityId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("Username") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("UniversityId"); - - b.ToTable("AppUsers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Size") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Active"); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("nvarchar(2048)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Assets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Carts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IconUrl") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Favourites"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CommissionAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsReviewed") - .HasColumnType("bit"); - - b.Property("TotalAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("PostId"); - - b.ToTable("OrderItems"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderPickups"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Comment") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderStatuses"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Method") - .HasColumnType("int"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("OrderId"); - - b.ToTable("Payments"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Condition") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(-1) - .HasColumnType("nvarchar(max)"); - - b.Property("ExpireDate") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Price") - .HasColumnType("decimal(18,2)"); - - b.Property("SellerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubCategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SellerId"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("Posts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("PostId"); - - b.ToTable("PostAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AskerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AskerId"); - - b.HasIndex("PostId"); - - b.ToTable("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .HasColumnType("int"); - - b.Property("Text") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("Reviews"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(5); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("PENDING"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ReviewUxes"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PaymentId"); - - b.HasIndex("WalletId"); - - b.ToTable("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ShipInfos"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityDescription") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Domain") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("nvarchar(48)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsSupported") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("Universities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("DetectedAt") - .HasColumnType("datetime2"); - - b.Property("Device") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FingerprintToken") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("nvarchar(45)"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("UserId"); - - b.ToTable("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Balance") - .HasColumnType("decimal(18, 4)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("Wallets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AdminNotes") - .HasColumnType("text"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ProcessingFee") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(18,2)") - .HasDefaultValue(0.0m); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("WalletId"); - - b.ToTable("WithdrawalRequests", (string)null); - }); - - modelBuilder.Entity("Dentizone.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.HasOne("Dentizone.Domain.Entity.Question", "Question") - .WithOne("Answer") - .HasForeignKey("Dentizone.Domain.Entity.Answer", "QuestionId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Question"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.HasOne("Dentizone.Domain.Entity.University", "University") - .WithMany("Users") - .HasForeignKey("UniversityId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Carts") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Carts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Favourites") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Favourites") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Orders") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Buyer"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany() - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderPickups") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderStatuses") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Payments") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany() - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Buyer"); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "Seller") - .WithMany("Posts") - .HasForeignKey("SellerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Seller"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("PostAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("PostAssets") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Asset"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Questions") - .HasForeignKey("AskerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Questions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("Review") - .HasForeignKey("Dentizone.Domain.Entity.Review", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Reviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ReviewUx") - .HasForeignKey("Dentizone.Domain.Entity.ReviewUx", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UXReviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.HasOne("Dentizone.Domain.Entity.Payment", "Payment") - .WithMany("SalesTransactions") - .HasForeignKey("PaymentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("SalesTransactions") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Payment"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ShipInfo") - .HasForeignKey("Dentizone.Domain.Entity.ShipInfo", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("ShippingAddresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("ShipmentActivities") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserActivities") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("UserAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserAssets") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Asset"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithOne("Wallet") - .HasForeignKey("Dentizone.Domain.Entity.Wallet", "UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("WithdrawalRequests") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("Orders"); - - b.Navigation("Payments"); - - b.Navigation("Posts"); - - b.Navigation("Questions"); - - b.Navigation("Reviews"); - - b.Navigation("ShippingAddresses"); - - b.Navigation("UXReviews"); - - b.Navigation("UserActivities"); - - b.Navigation("UserAssets"); - - b.Navigation("Wallet") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Navigation("PostAssets"); - - b.Navigation("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Navigation("OrderItems"); - - b.Navigation("OrderPickups"); - - b.Navigation("OrderStatuses"); - - b.Navigation("Review") - .IsRequired(); - - b.Navigation("ReviewUx") - .IsRequired(); - - b.Navigation("ShipInfo") - .IsRequired(); - - b.Navigation("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Navigation("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("PostAssets"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Navigation("Answer") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Navigation("SalesTransactions"); - - b.Navigation("WithdrawalRequests"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.cs b/Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.cs deleted file mode 100644 index cee1325..0000000 --- a/Dentizone.Infrastructure/Migrations/20250624175713_OptmizeOrder.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - /// - public partial class OptmizeOrder : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IsReviewed", - table: "Orders", - type: "bit", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IsReviewed", - table: "Orders"); - } - } -} diff --git a/Dentizone.Infrastructure/Migrations/20250626085204_M.Designer.cs b/Dentizone.Infrastructure/Migrations/20250626085204_M.Designer.cs deleted file mode 100644 index 9a80e5a..0000000 --- a/Dentizone.Infrastructure/Migrations/20250626085204_M.Designer.cs +++ /dev/null @@ -1,1700 +0,0 @@ -// -using System; -using Dentizone.Infrastructure; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250626085204_M")] - partial class M - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("QuestionId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId") - .IsUnique(); - - b.ToTable("Answers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AcademicYear") - .HasColumnType("int"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("KycStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NationalId") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UniversityId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("Username") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("UniversityId"); - - b.ToTable("AppUsers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Size") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Active"); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("nvarchar(2048)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Assets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Carts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IconUrl") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Favourites"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CommissionAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsReviewed") - .HasColumnType("bit"); - - b.Property("TotalAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("PostId"); - - b.ToTable("OrderItems"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderPickups"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Comment") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderStatuses"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Method") - .HasColumnType("int"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("OrderId"); - - b.ToTable("Payments"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Condition") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(-1) - .HasColumnType("nvarchar(max)"); - - b.Property("ExpireDate") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Price") - .HasColumnType("decimal(18,2)"); - - b.Property("SellerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubCategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SellerId"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("Posts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("PostId"); - - b.ToTable("PostAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AskerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AskerId"); - - b.HasIndex("PostId"); - - b.ToTable("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .HasColumnType("int"); - - b.Property("Text") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("Reviews"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(5); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("PENDING"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ReviewUxes"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PaymentId"); - - b.HasIndex("WalletId"); - - b.ToTable("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ShipInfos"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityDescription") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ItemId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Domain") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("nvarchar(48)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsSupported") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("Universities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("DetectedAt") - .HasColumnType("datetime2"); - - b.Property("Device") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FingerprintToken") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("nvarchar(45)"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("UserId"); - - b.ToTable("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Balance") - .HasColumnType("decimal(18, 4)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("Wallets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AdminNotes") - .HasColumnType("text"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ProcessingFee") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(18,2)") - .HasDefaultValue(0.0m); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("WalletId"); - - b.ToTable("WithdrawalRequests", (string)null); - }); - - modelBuilder.Entity("Dentizone.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.HasOne("Dentizone.Domain.Entity.Question", "Question") - .WithOne("Answer") - .HasForeignKey("Dentizone.Domain.Entity.Answer", "QuestionId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Question"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.HasOne("Dentizone.Domain.Entity.University", "University") - .WithMany("Users") - .HasForeignKey("UniversityId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Carts") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Carts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Favourites") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Favourites") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Orders") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Buyer"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany() - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderPickups") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderStatuses") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Payments") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany() - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Buyer"); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "Seller") - .WithMany("Posts") - .HasForeignKey("SellerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Seller"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("PostAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("PostAssets") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Asset"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Questions") - .HasForeignKey("AskerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Questions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("Review") - .HasForeignKey("Dentizone.Domain.Entity.Review", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Reviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ReviewUx") - .HasForeignKey("Dentizone.Domain.Entity.ReviewUx", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UXReviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.HasOne("Dentizone.Domain.Entity.Payment", "Payment") - .WithMany("SalesTransactions") - .HasForeignKey("PaymentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("SalesTransactions") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Payment"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ShipInfo") - .HasForeignKey("Dentizone.Domain.Entity.ShipInfo", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("ShippingAddresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.OrderItem", "Item") - .WithMany("ShipmentActivities") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserActivities") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("UserAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserAssets") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Asset"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithOne("Wallet") - .HasForeignKey("Dentizone.Domain.Entity.Wallet", "UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("WithdrawalRequests") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("Orders"); - - b.Navigation("Payments"); - - b.Navigation("Posts"); - - b.Navigation("Questions"); - - b.Navigation("Reviews"); - - b.Navigation("ShippingAddresses"); - - b.Navigation("UXReviews"); - - b.Navigation("UserActivities"); - - b.Navigation("UserAssets"); - - b.Navigation("Wallet") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Navigation("PostAssets"); - - b.Navigation("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Navigation("OrderItems"); - - b.Navigation("OrderPickups"); - - b.Navigation("OrderStatuses"); - - b.Navigation("Review") - .IsRequired(); - - b.Navigation("ReviewUx") - .IsRequired(); - - b.Navigation("ShipInfo") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.Navigation("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Navigation("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("PostAssets"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Navigation("Answer") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Navigation("SalesTransactions"); - - b.Navigation("WithdrawalRequests"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Dentizone.Infrastructure/Migrations/20250626085204_M.cs b/Dentizone.Infrastructure/Migrations/20250626085204_M.cs deleted file mode 100644 index f2b4ee7..0000000 --- a/Dentizone.Infrastructure/Migrations/20250626085204_M.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - /// - public partial class M : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ShipmentActivities_Orders_OrderId", - table: "ShipmentActivities"); - - migrationBuilder.RenameColumn( - name: "OrderId", - table: "ShipmentActivities", - newName: "ItemId"); - - migrationBuilder.RenameIndex( - name: "IX_ShipmentActivities_OrderId", - table: "ShipmentActivities", - newName: "IX_ShipmentActivities_ItemId"); - - migrationBuilder.AddForeignKey( - name: "FK_ShipmentActivities_OrderItems_ItemId", - table: "ShipmentActivities", - column: "ItemId", - principalTable: "OrderItems", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ShipmentActivities_OrderItems_ItemId", - table: "ShipmentActivities"); - - migrationBuilder.RenameColumn( - name: "ItemId", - table: "ShipmentActivities", - newName: "OrderId"); - - migrationBuilder.RenameIndex( - name: "IX_ShipmentActivities_ItemId", - table: "ShipmentActivities", - newName: "IX_ShipmentActivities_OrderId"); - - migrationBuilder.AddForeignKey( - name: "FK_ShipmentActivities_Orders_OrderId", - table: "ShipmentActivities", - column: "OrderId", - principalTable: "Orders", - principalColumn: "Id"); - } - } -} diff --git a/Dentizone.Infrastructure/Migrations/AppDbContextModelSnapshot.cs b/Dentizone.Infrastructure/Migrations/AppDbContextModelSnapshot.cs deleted file mode 100644 index 62947ad..0000000 --- a/Dentizone.Infrastructure/Migrations/AppDbContextModelSnapshot.cs +++ /dev/null @@ -1,1697 +0,0 @@ -// -using System; -using Dentizone.Infrastructure; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Dentizone.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - partial class AppDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("QuestionId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId") - .IsUnique(); - - b.ToTable("Answers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AcademicYear") - .HasColumnType("int"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("KycStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NationalId") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UniversityId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("Username") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("UniversityId"); - - b.ToTable("AppUsers"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Size") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Active"); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("nvarchar(2048)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Assets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Carts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IconUrl") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("Favourites"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CommissionAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsReviewed") - .HasColumnType("bit"); - - b.Property("TotalAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("PostId"); - - b.ToTable("OrderItems"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderPickups"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Comment") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderStatuses"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("BuyerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Method") - .HasColumnType("int"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("OrderId"); - - b.ToTable("Payments"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Condition") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(-1) - .HasColumnType("nvarchar(max)"); - - b.Property("ExpireDate") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Price") - .HasColumnType("decimal(18,2)"); - - b.Property("SellerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubCategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SellerId"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("Posts"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("PostId"); - - b.ToTable("PostAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AskerId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Text") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AskerId"); - - b.HasIndex("PostId"); - - b.ToTable("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .HasColumnType("int"); - - b.Property("Text") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("Reviews"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Stars") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(5); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("PENDING"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ReviewUxes"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("PaymentId"); - - b.HasIndex("WalletId"); - - b.ToTable("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("City") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("OrderId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Street") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("ShipInfos"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityDescription") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ItemId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CategoryId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Domain") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("nvarchar(48)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("IsSupported") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("Universities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ActivityType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("DetectedAt") - .HasColumnType("datetime2"); - - b.Property("Device") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FingerprintToken") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("nvarchar(512)"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("nvarchar(45)"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AssetId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("AssetId"); - - b.HasIndex("UserId"); - - b.ToTable("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Balance") - .HasColumnType("decimal(18, 4)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime2"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("Wallets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AdminNotes") - .HasColumnType("text"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ProcessingFee") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(18,2)") - .HasDefaultValue(0.0m); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Pending"); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("WalletId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("WalletId"); - - b.ToTable("WithdrawalRequests", (string)null); - }); - - modelBuilder.Entity("Dentizone.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Answer", b => - { - b.HasOne("Dentizone.Domain.Entity.Question", "Question") - .WithOne("Answer") - .HasForeignKey("Dentizone.Domain.Entity.Answer", "QuestionId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Question"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.HasOne("Dentizone.Domain.Entity.University", "University") - .WithMany("Users") - .HasForeignKey("UniversityId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Cart", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Carts") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Carts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Favourite", b => - { - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Favourites") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Favourites") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Orders") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Buyer"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany() - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderPickup", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderPickups") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderStatus", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany("OrderStatuses") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "Buyer") - .WithMany("Payments") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithMany() - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Buyer"); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "Seller") - .WithMany("Posts") - .HasForeignKey("SellerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Seller"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.PostAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("PostAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("PostAssets") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Asset"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Questions") - .HasForeignKey("AskerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Post", "Post") - .WithMany("Questions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Review", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("Review") - .HasForeignKey("Dentizone.Domain.Entity.Review", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("Reviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ReviewUx", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ReviewUx") - .HasForeignKey("Dentizone.Domain.Entity.ReviewUx", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UXReviews") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SalesTransaction", b => - { - b.HasOne("Dentizone.Domain.Entity.Payment", "Payment") - .WithMany("SalesTransactions") - .HasForeignKey("PaymentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("SalesTransactions") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Payment"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipInfo", b => - { - b.HasOne("Dentizone.Domain.Entity.Order", "Order") - .WithOne("ShipInfo") - .HasForeignKey("Dentizone.Domain.Entity.ShipInfo", "OrderId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("ShippingAddresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.ShipmentActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.OrderItem", "Item") - .WithMany("ShipmentActivities") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.SubCategory", b => - { - b.HasOne("Dentizone.Domain.Entity.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserActivity", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserActivities") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.UserAsset", b => - { - b.HasOne("Dentizone.Domain.Entity.Asset", "Asset") - .WithMany("UserAssets") - .HasForeignKey("AssetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithMany("UserAssets") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Asset"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.HasOne("Dentizone.Domain.Entity.AppUser", "User") - .WithOne("Wallet") - .HasForeignKey("Dentizone.Domain.Entity.Wallet", "UserId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.WithdrawalRequest", b => - { - b.HasOne("Dentizone.Domain.Entity.Wallet", "Wallet") - .WithMany("WithdrawalRequests") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Dentizone.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.AppUser", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("Orders"); - - b.Navigation("Payments"); - - b.Navigation("Posts"); - - b.Navigation("Questions"); - - b.Navigation("Reviews"); - - b.Navigation("ShippingAddresses"); - - b.Navigation("UXReviews"); - - b.Navigation("UserActivities"); - - b.Navigation("UserAssets"); - - b.Navigation("Wallet") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Asset", b => - { - b.Navigation("PostAssets"); - - b.Navigation("UserAssets"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Order", b => - { - b.Navigation("OrderItems"); - - b.Navigation("OrderPickups"); - - b.Navigation("OrderStatuses"); - - b.Navigation("Review") - .IsRequired(); - - b.Navigation("ReviewUx") - .IsRequired(); - - b.Navigation("ShipInfo") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.OrderItem", b => - { - b.Navigation("ShipmentActivities"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Payment", b => - { - b.Navigation("SalesTransactions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Post", b => - { - b.Navigation("Carts"); - - b.Navigation("Favourites"); - - b.Navigation("PostAssets"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Question", b => - { - b.Navigation("Answer") - .IsRequired(); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.University", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Dentizone.Domain.Entity.Wallet", b => - { - b.Navigation("SalesTransactions"); - - b.Navigation("WithdrawalRequests"); - }); -#pragma warning restore 612, 618 - } - } -} From ebadf215e1ef2b31e721a8f11c25a2433f07800a Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 22:20:07 +0300 Subject: [PATCH 6/9] Make properties required in UserView and Post classes Updated the `UserView` class to require the `UnversityName` property. In the `Post` class, the `Slug` property is now also required. These changes ensure that essential properties must be set when creating instances of these classes. --- Dentizone.Application/DTOs/User/UserView.cs | 2 +- Dentizone.Domain/Entity/Post.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dentizone.Application/DTOs/User/UserView.cs b/Dentizone.Application/DTOs/User/UserView.cs index 0edcf99..185a6c2 100644 --- a/Dentizone.Application/DTOs/User/UserView.cs +++ b/Dentizone.Application/DTOs/User/UserView.cs @@ -5,6 +5,6 @@ public class UserView public string Id { get; set; } public string Username { get; set; } public int AcademicYear { get; set; } - public string UnversityName { get; set; } + public required string UnversityName { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Post.cs b/Dentizone.Domain/Entity/Post.cs index 84ac436..cde48bc 100644 --- a/Dentizone.Domain/Entity/Post.cs +++ b/Dentizone.Domain/Entity/Post.cs @@ -13,7 +13,7 @@ public class Post : IBaseEntity, IUpdatable, IDeletable public DateTime? ExpireDate { get; set; } public PostItemCondition Condition { get; set; } public PostStatus Status { get; set; } = PostStatus.Active; - public string Slug { get; set; } + public required string Slug { get; set; } public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } From 0c7c3633e9441e4a01699a4ad5ae1d2c7b895d46 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 22:20:27 +0300 Subject: [PATCH 7/9] Enhance data integrity and code readability - Added `required` keyword to various DTOs and entity classes to enforce mandatory fields. - Updated mapping syntax in `CartProfile.cs` for improved readability. - Fixed property name in `UserProfile.cs` from `UnversityName` to `UniversityName`. - Initialized dictionaries with `new()` in several DTOs for conciseness. - Removed `AdminController` functionality, integrating it into `WalletController`. - Updated `UniversitySeeder` to use concise object initializer syntax. - Modified repository methods to include optional parameters for flexibility. - Set default environment variable to "dev" in `SecretService`. - Updated solution file to include new entry for `Presentaion` namespace. --- .../AutoMapper/Carts/CartProfile.cs | 30 +++--- .../AutoMapper/UserProfile.cs | 2 +- .../DTOs/Analytics/PostAnalyticsDTO.cs | 2 +- .../DTOs/Analytics/UserAnalyticsDTO.cs | 2 +- .../DTOs/Auth/ConfirmEmailRequestDto.cs | 4 +- .../DTOs/Auth/RegisterRequestDto.cs | 12 +-- .../DTOs/Auth/ResetPasswordDto.cs | 6 +- .../DTOs/Cart/CartItemDTO.cs | 8 +- .../DTOs/Catalog/CategoryDTO.cs | 2 +- .../DTOs/Catalog/CategoryView.cs | 4 +- .../DTOs/Catalog/CreatedSubCategoryDTO.cs | 4 +- .../DTOs/Catalog/SubCategoryDTO.cs | 4 +- .../DTOs/Catalog/SubCategoryView.cs | 6 +- Dentizone.Application/DTOs/ErrorResponse.cs | 2 +- .../DTOs/Favorites/FavoriteViewDto.cs | 4 +- .../DTOs/Order/CreateOrderDTO.cs | 4 +- .../DTOs/Order/OrderItemDto.cs | 6 +- .../DTOs/Order/OrderShipInfoDto.cs | 4 +- .../DTOs/Order/OrderStatusTimeline.cs | 2 +- .../DTOs/Order/OrderViewDTO.cs | 8 +- .../DTOs/Order/ShipInfoDto.cs | 4 +- .../DTOs/Payment/PaymentDto.cs | 4 +- .../DTOs/Payment/PaymentView.cs | 8 +- .../DTOs/Post/CreatePostDTO.cs | 14 +-- .../DTOs/Post/PostAssetView.cs | 4 +- .../Post/PostFilterDto/CategoryFilterDTO.cs | 6 +- .../Post/PostFilterDto/SidebarFilterDTO.cs | 4 +- .../DTOs/Post/PostViewDTO.cs | 20 ++-- .../DTOs/Post/UpdatePostDTO.cs | 8 +- .../DTOs/Q&A/AnswerDTO/AnswerViewDto.cs | 6 +- .../DTOs/Q&A/AnswerDTO/CreateAnswerDto.cs | 2 +- .../DTOs/Q&A/AnswerDTO/UpdateAnswerDto.cs | 2 +- .../DTOs/Q&A/QuestionDTO/CreateQuestionDto.cs | 2 +- .../DTOs/Q&A/QuestionDTO/QuestionViewDto.cs | 6 +- .../DTOs/Review/CreateReviewDTO.cs | 4 +- .../DTOs/Review/ReviewDTO.cs | 2 +- .../University/SupportedUniversitiesDTO.cs | 1 - .../DTOs/University/University.cs | 6 +- .../DTOs/University/UniversityView.cs | 6 +- .../DTOs/User/CreateAppUser.cs | 10 +- Dentizone.Application/DTOs/User/DomainUser.cs | 8 +- .../DTOs/User/LoggedInUser.cs | 2 +- Dentizone.Application/DTOs/User/UserDTO.cs | 11 +-- Dentizone.Application/DTOs/User/UserView.cs | 6 +- .../UserActivity/UniversitiesByUserDto.cs | 2 +- .../DTOs/UserActivity/UserActivityDTO.cs | 14 +-- .../DTOs/Withdrawal/ApproveWithdrawalDto.cs | 2 +- .../DTOs/Withdrawal/WithdrawalRequestDto.cs | 2 +- .../DTOs/Withdrawal/WithdrawalRequestView.cs | 10 +- .../Authentication/VerificationService.cs | 4 +- .../Services/CloudinaryService.cs | 3 +- .../Services/Payment/WalletService.cs | 4 +- .../Services/UserActivityService.cs | 3 +- Dentizone.Domain/Entity/Answer.cs | 6 +- Dentizone.Domain/Entity/AppUser.cs | 14 +-- Dentizone.Domain/Entity/Asset.cs | 6 +- Dentizone.Domain/Entity/Cart.cs | 6 +- Dentizone.Domain/Entity/Category.cs | 4 +- Dentizone.Domain/Entity/Favourite.cs | 10 +- Dentizone.Domain/Entity/Order.cs | 8 +- Dentizone.Domain/Entity/OrderItem.cs | 8 +- Dentizone.Domain/Entity/OrderPickup.cs | 8 +- Dentizone.Domain/Entity/OrderStatus.cs | 4 +- Dentizone.Domain/Entity/Payment.cs | 8 +- Dentizone.Domain/Entity/Post.cs | 22 ++--- Dentizone.Domain/Entity/PostAsset.cs | 22 ++--- Dentizone.Domain/Entity/Question.cs | 12 +-- Dentizone.Domain/Entity/Review.cs | 10 +- Dentizone.Domain/Entity/SalesTransaction.cs | 8 +- Dentizone.Domain/Entity/ShipInfo.cs | 12 +-- Dentizone.Domain/Entity/ShipmentActivity.cs | 18 ++-- Dentizone.Domain/Entity/SubCategory.cs | 6 +- Dentizone.Domain/Entity/University.cs | 4 +- Dentizone.Domain/Entity/UserActivity.cs | 12 +-- Dentizone.Domain/Entity/UserAsset.cs | 8 +- Dentizone.Domain/Entity/Wallet.cs | 4 +- Dentizone.Domain/Entity/WithdrawalRequest.cs | 4 +- .../ApiClient/KYC/IdVerification.cs | 32 +++--- .../ApiClient/KYC/SessionDecisionResponse.cs | 6 +- .../Persistence/Seeder/UniversitySeeder.cs | 99 +++++++++---------- .../Repositories/AnswerRepository.cs | 7 +- .../Secret/SecretService.cs | 2 +- .../Controllers/AdminController.cs | 27 ----- .../Controllers/WalletController.cs | 17 ++++ Dentizone.sln.DotSettings | 3 +- 85 files changed, 353 insertions(+), 370 deletions(-) delete mode 100644 Dentizone.Presentaion/Controllers/AdminController.cs diff --git a/Dentizone.Application/AutoMapper/Carts/CartProfile.cs b/Dentizone.Application/AutoMapper/Carts/CartProfile.cs index 08a640f..c9d57b1 100644 --- a/Dentizone.Application/AutoMapper/Carts/CartProfile.cs +++ b/Dentizone.Application/AutoMapper/Carts/CartProfile.cs @@ -12,23 +12,23 @@ public CartProfile() .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.PostId, opt => opt.MapFrom(src => src.PostId)) .ForMember(dest => dest.Post, opt => opt.MapFrom(src => new Post - { - Title = src.Title, - Price = src.Price, - PostAssets = new List - { - new PostAsset - { - Asset = new Domain.Entity.Asset - { - Url = src.Url - } - } - } - })) + { + Title = src.Title, + Price = src.Price, + PostAssets = new List + { + new() + { + Asset = new Domain.Entity.Asset + { + Url = src.Url + } + } + } + })) .ReverseMap() .ForMember(dest => dest.Url, opt => opt.MapFrom(src => - src.Post.PostAssets.FirstOrDefault().Asset.Url)) + src.Post.PostAssets.FirstOrDefault().Asset.Url)) .ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Post.Title)) .ForMember(dest => dest.Price, opt => opt.MapFrom(src => src.Post.Price)); diff --git a/Dentizone.Application/AutoMapper/UserProfile.cs b/Dentizone.Application/AutoMapper/UserProfile.cs index f05a9b4..18bd0f9 100644 --- a/Dentizone.Application/AutoMapper/UserProfile.cs +++ b/Dentizone.Application/AutoMapper/UserProfile.cs @@ -24,7 +24,7 @@ public UserProfile() .ReverseMap() .ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.Status)); CreateMap() - .ForPath(dest => dest.University.Name, opt => opt.MapFrom(src => src.UnversityName)) + .ForPath(dest => dest.University.Name, opt => opt.MapFrom(src => src.UniversityName)) .ReverseMap(); CreateMap() diff --git a/Dentizone.Application/DTOs/Analytics/PostAnalyticsDTO.cs b/Dentizone.Application/DTOs/Analytics/PostAnalyticsDTO.cs index 44d40d7..946f3a1 100644 --- a/Dentizone.Application/DTOs/Analytics/PostAnalyticsDTO.cs +++ b/Dentizone.Application/DTOs/Analytics/PostAnalyticsDTO.cs @@ -6,6 +6,6 @@ public class PostAnalyticsDto public int PendingPosts { get; set; } public decimal AveragePostPrice { get; set; } - public Dictionary PostsByCategory { get; set; } = new Dictionary(); + public Dictionary PostsByCategory { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Analytics/UserAnalyticsDTO.cs b/Dentizone.Application/DTOs/Analytics/UserAnalyticsDTO.cs index dbc0906..c4628b3 100644 --- a/Dentizone.Application/DTOs/Analytics/UserAnalyticsDTO.cs +++ b/Dentizone.Application/DTOs/Analytics/UserAnalyticsDTO.cs @@ -6,6 +6,6 @@ public class UserAnalyticsDto public int NewUsersLast7Days { get; set; } public int NewUsersLast30Days { get; set; } - public Dictionary UsersByUniversity { get; set; } = new Dictionary(); + public Dictionary UsersByUniversity { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Auth/ConfirmEmailRequestDto.cs b/Dentizone.Application/DTOs/Auth/ConfirmEmailRequestDto.cs index 0618ded..77c850c 100644 --- a/Dentizone.Application/DTOs/Auth/ConfirmEmailRequestDto.cs +++ b/Dentizone.Application/DTOs/Auth/ConfirmEmailRequestDto.cs @@ -2,6 +2,6 @@ public class ConfirmEmailRequestDto { - public string Token { get; set; } - public string UserId { get; set; } + public required string Token { get; set; } + public required string UserId { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Auth/RegisterRequestDto.cs b/Dentizone.Application/DTOs/Auth/RegisterRequestDto.cs index 1131f3f..1ebebb3 100644 --- a/Dentizone.Application/DTOs/Auth/RegisterRequestDto.cs +++ b/Dentizone.Application/DTOs/Auth/RegisterRequestDto.cs @@ -4,12 +4,12 @@ namespace Dentizone.Application.DTOs.Auth; public class RegisterRequestDto { - public string Email { get; set; } - public string Password { get; set; } - public string FullName { get; set; } - public string Username { get; set; } + public required string Email { get; set; } + public required string Password { get; set; } + public required string FullName { get; set; } + public required string Username { get; set; } public int AcademicYear { get; set; } - public string UniversityId { get; set; } + public required string UniversityId { get; set; } } public class RegisterRequestDtoValidator : AbstractValidator @@ -25,7 +25,7 @@ public RegisterRequestDtoValidator() RuleFor(x => x.FullName).NotEmpty().WithMessage("Full name is required."); RuleFor(x => x.Username).NotEmpty().WithMessage("Username is required."); RuleFor(x => x.AcademicYear).GreaterThan(0).LessThanOrEqualTo(5) - .WithMessage("Academic year must be greater than 0 and less than 6."); + .WithMessage("Academic year must be greater than 0 and less than 6."); RuleFor(x => x.UniversityId).NotEmpty().WithMessage("University ID is required."); } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Auth/ResetPasswordDto.cs b/Dentizone.Application/DTOs/Auth/ResetPasswordDto.cs index 8908f59..f5e8ef9 100644 --- a/Dentizone.Application/DTOs/Auth/ResetPasswordDto.cs +++ b/Dentizone.Application/DTOs/Auth/ResetPasswordDto.cs @@ -2,8 +2,8 @@ { public class ResetPasswordDto { - public string NewPassword { get; set; } - public string Token { get; set; } - public string Email { get; set; } + public required string NewPassword { get; set; } + public required string Token { get; set; } + public required string Email { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Cart/CartItemDTO.cs b/Dentizone.Application/DTOs/Cart/CartItemDTO.cs index b41c53e..ef3d6a1 100644 --- a/Dentizone.Application/DTOs/Cart/CartItemDTO.cs +++ b/Dentizone.Application/DTOs/Cart/CartItemDTO.cs @@ -2,10 +2,10 @@ { public class CartItemDto { - public string Id { get; set; } - public string PostId { get; set; } - public string Title { get; set; } + public required string Id { get; set; } + public required string PostId { get; set; } + public required string Title { get; set; } public decimal Price { get; set; } - public string Url { get; set; } + public required string Url { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Catalog/CategoryDTO.cs b/Dentizone.Application/DTOs/Catalog/CategoryDTO.cs index 0cd3cbd..1e58da1 100644 --- a/Dentizone.Application/DTOs/Catalog/CategoryDTO.cs +++ b/Dentizone.Application/DTOs/Catalog/CategoryDTO.cs @@ -4,7 +4,7 @@ namespace Dentizone.Application.DTOs.Catalog { public class CategoryDto { - public string Name { get; set; } + public required string Name { get; set; } public string IconUrl { get; set; } = string.Empty; } diff --git a/Dentizone.Application/DTOs/Catalog/CategoryView.cs b/Dentizone.Application/DTOs/Catalog/CategoryView.cs index 45ff407..6f97dfe 100644 --- a/Dentizone.Application/DTOs/Catalog/CategoryView.cs +++ b/Dentizone.Application/DTOs/Catalog/CategoryView.cs @@ -4,8 +4,8 @@ namespace Dentizone.Application.DTOs.Catalog { public class CategoryView { - public string Id { get; set; } - public string Name { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } } public class CreatedCategoryDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs b/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs index 4c15a06..05748d7 100644 --- a/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs +++ b/Dentizone.Application/DTOs/Catalog/CreatedSubCategoryDTO.cs @@ -4,8 +4,8 @@ namespace Dentizone.Application.DTOs.Catalog { public class CreatedSubCategoryDto { - public string Id { get; set; } - public string Name { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } } public class CreatedSubCategoryDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs b/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs index 1c14bd7..c95cced 100644 --- a/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs +++ b/Dentizone.Application/DTOs/Catalog/SubCategoryDTO.cs @@ -4,8 +4,8 @@ namespace Dentizone.Application.DTOs.Catalog { public class SubCategoryDto { - public string Name { get; set; } - public string CategoryId { get; set; } + public required string Name { get; set; } + public required string CategoryId { get; set; } } public class SubCategoryDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Catalog/SubCategoryView.cs b/Dentizone.Application/DTOs/Catalog/SubCategoryView.cs index 77b520a..abf2a66 100644 --- a/Dentizone.Application/DTOs/Catalog/SubCategoryView.cs +++ b/Dentizone.Application/DTOs/Catalog/SubCategoryView.cs @@ -2,7 +2,7 @@ public class SubCategoryView { - public string Name { get; set; } - public string Id { get; set; } - public CategoryView Category { get; set; } + public required string Name { get; set; } + public required string Id { get; set; } + public required CategoryView Category { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/ErrorResponse.cs b/Dentizone.Application/DTOs/ErrorResponse.cs index bb0b9f2..1199c98 100644 --- a/Dentizone.Application/DTOs/ErrorResponse.cs +++ b/Dentizone.Application/DTOs/ErrorResponse.cs @@ -2,7 +2,7 @@ namespace Dentizone.Application.DTOs; public class ErrorResponse { - public string Message { get; set; } + public required string Message { get; set; } public string? Details { get; set; } public int StatusCode { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs b/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs index 635c46e..b2e784b 100644 --- a/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs +++ b/Dentizone.Application/DTOs/Favorites/FavoriteViewDto.cs @@ -4,7 +4,7 @@ namespace Dentizone.Application.DTOs.Favorites { public class FavoriteViewDto { - public string Id { get; set; } - public PostViewDto Post { get; set; } = new PostViewDto(); + public string Id { get; set; } = string.Empty; + public PostViewDto Post { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Order/CreateOrderDTO.cs b/Dentizone.Application/DTOs/Order/CreateOrderDTO.cs index b7d935f..95fd8ff 100644 --- a/Dentizone.Application/DTOs/Order/CreateOrderDTO.cs +++ b/Dentizone.Application/DTOs/Order/CreateOrderDTO.cs @@ -4,8 +4,8 @@ namespace Dentizone.Application.DTOs.Order { public class CreateOrderDto { - public List PostIds { get; set; } = new List(); - public ShipInfoDto ShipInfo { get; set; } = new ShipInfoDto(); + public List PostIds { get; set; } = new(); + public ShipInfoDto ShipInfo { get; set; } = new(); } public class ShipInfoDtoValidation : AbstractValidator diff --git a/Dentizone.Application/DTOs/Order/OrderItemDto.cs b/Dentizone.Application/DTOs/Order/OrderItemDto.cs index b5c0773..db74c6f 100644 --- a/Dentizone.Application/DTOs/Order/OrderItemDto.cs +++ b/Dentizone.Application/DTOs/Order/OrderItemDto.cs @@ -2,9 +2,9 @@ public class OrderItemDto { - public string Id { get; set; } - public string PostId { get; set; } - public string PostTitle { get; set; } + public required string Id { get; set; } + public required string PostId { get; set; } + public required string PostTitle { get; set; } public decimal Price { get; set; } public DateTime CreatedAt { get; set; } diff --git a/Dentizone.Application/DTOs/Order/OrderShipInfoDto.cs b/Dentizone.Application/DTOs/Order/OrderShipInfoDto.cs index 5f5ed03..fdb3eff 100644 --- a/Dentizone.Application/DTOs/Order/OrderShipInfoDto.cs +++ b/Dentizone.Application/DTOs/Order/OrderShipInfoDto.cs @@ -2,6 +2,6 @@ public class OrderShipInfoDto { - public string Street { get; set; } - public string City { get; set; } + public string Street { get; set; } = string.Empty; + public string City { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Order/OrderStatusTimeline.cs b/Dentizone.Application/DTOs/Order/OrderStatusTimeline.cs index 91172f7..6a480f3 100644 --- a/Dentizone.Application/DTOs/Order/OrderStatusTimeline.cs +++ b/Dentizone.Application/DTOs/Order/OrderStatusTimeline.cs @@ -2,6 +2,6 @@ public class OrderStatusTimeline { - public string Status { get; set; } + public required string Status { get; set; } public DateTime Timestamp { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Order/OrderViewDTO.cs b/Dentizone.Application/DTOs/Order/OrderViewDTO.cs index d264110..bed2cbb 100644 --- a/Dentizone.Application/DTOs/Order/OrderViewDTO.cs +++ b/Dentizone.Application/DTOs/Order/OrderViewDTO.cs @@ -2,14 +2,14 @@ { public class OrderViewDto { - public string Id { get; set; } - public string BuyerName { get; set; } + public string Id { get; set; } = string.Empty; + public string BuyerName { get; set; } = string.Empty; public int TotalAmount { get; set; } - public OrderShipInfoDto OrderShipmentAddress { get; set; } = new OrderShipInfoDto(); + public OrderShipInfoDto OrderShipmentAddress { get; set; } = new(); public DateTime CreatedAt { get; set; } public IReadOnlyCollection StatusTimeline { get; set; } = new List(); - public List OrderItems { get; set; } = new List(); + public List OrderItems { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Order/ShipInfoDto.cs b/Dentizone.Application/DTOs/Order/ShipInfoDto.cs index 4322d29..11dfd11 100644 --- a/Dentizone.Application/DTOs/Order/ShipInfoDto.cs +++ b/Dentizone.Application/DTOs/Order/ShipInfoDto.cs @@ -2,6 +2,6 @@ public class ShipInfoDto { - public string Address { get; set; } - public string City { get; set; } + public string Address { get; set; } = string.Empty; + public string City { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Payment/PaymentDto.cs b/Dentizone.Application/DTOs/Payment/PaymentDto.cs index 66a0793..35c3785 100644 --- a/Dentizone.Application/DTOs/Payment/PaymentDto.cs +++ b/Dentizone.Application/DTOs/Payment/PaymentDto.cs @@ -4,8 +4,8 @@ namespace Dentizone.Application.DTOs.Payment; public class PaymentDto { - public string OrderId { get; set; } - public string BuyerId { get; set; } + public required string OrderId { get; set; } + public required string BuyerId { get; set; } public decimal Amount { get; set; } public PaymentMethod PaymentMethod { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Payment/PaymentView.cs b/Dentizone.Application/DTOs/Payment/PaymentView.cs index 9b53236..07cc556 100644 --- a/Dentizone.Application/DTOs/Payment/PaymentView.cs +++ b/Dentizone.Application/DTOs/Payment/PaymentView.cs @@ -4,10 +4,10 @@ namespace Dentizone.Application.DTOs.Payment; public class PaymentView { - public string Id { get; set; } - public string OrderId { get; set; } - public string BuyerId { get; set; } - public string BuyerName { get; set; } + public required string Id { get; set; } + public required string OrderId { get; set; } + public required string BuyerId { get; set; } + public required string BuyerName { get; set; } public decimal Amount { get; set; } public PaymentMethod Method { get; set; } public DateTime CreatedAt { get; set; } diff --git a/Dentizone.Application/DTOs/Post/CreatePostDTO.cs b/Dentizone.Application/DTOs/Post/CreatePostDTO.cs index 1c8595e..1ab7dc9 100644 --- a/Dentizone.Application/DTOs/Post/CreatePostDTO.cs +++ b/Dentizone.Application/DTOs/Post/CreatePostDTO.cs @@ -5,17 +5,17 @@ namespace Dentizone.Application.DTOs.Post { public class CreatePostDto { - public string Title { get; set; } - public string Description { get; set; } + public required string Title { get; set; } + public required string Description { get; set; } public decimal Price { get; set; } public PostItemCondition Condition { get; set; } - public string Street { get; set; } - public string City { get; set; } - public string CategoryId { get; set; } - public string SubCategoryId { get; set; } + public required string Street { get; set; } + public required string City { get; set; } + public required string CategoryId { get; set; } + public required string SubCategoryId { get; set; } public DateTime? ExpireDate { get; set; } - public List AssetIds { get; set; } + public required List AssetIds { get; set; } } public class CreatePostDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Post/PostAssetView.cs b/Dentizone.Application/DTOs/Post/PostAssetView.cs index 1cc2ee5..d765beb 100644 --- a/Dentizone.Application/DTOs/Post/PostAssetView.cs +++ b/Dentizone.Application/DTOs/Post/PostAssetView.cs @@ -2,7 +2,7 @@ { public class PostAssetView { - public string Id { get; set; } - public string Url { get; set; } + public required string Id { get; set; } + public required string Url { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs b/Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs index cd31f44..bb12e0d 100644 --- a/Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostFilterDto/CategoryFilterDTO.cs @@ -2,8 +2,8 @@ { public class CategoryFilterDto { - public string Id { get; set; } - public string CategoryName { get; set; } - public List Subcategories { get; set; } = new List(); + public required string Id { get; set; } + public required string CategoryName { get; set; } + public List Subcategories { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs b/Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs index b905bab..5387ea7 100644 --- a/Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostFilterDto/SidebarFilterDTO.cs @@ -2,8 +2,8 @@ { public class SidebarFilterDto { - public List Cities { get; set; } = new List(); - public List Categories { get; set; } = new List(); + public List Cities { get; set; } = new(); + public List Categories { get; set; } = new(); public decimal MinPrice { get; set; } public decimal MaxPrice { get; set; } } diff --git a/Dentizone.Application/DTOs/Post/PostViewDTO.cs b/Dentizone.Application/DTOs/Post/PostViewDTO.cs index abf2de8..7635878 100644 --- a/Dentizone.Application/DTOs/Post/PostViewDTO.cs +++ b/Dentizone.Application/DTOs/Post/PostViewDTO.cs @@ -4,16 +4,16 @@ namespace Dentizone.Application.DTOs.Post { public class PostViewDto { - public string Id { get; set; } - public string Title { get; set; } - public string Description { get; set; } - public decimal Price { get; set; } - public DateTime? ExpireDate { get; set; } - public string Condition { get; set; } - public string Category { get; set; } - public string SubCatgory { get; set; } - public string Status { get; set; } - public UserView Seller { get; set; } + public string Id { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public decimal Price { get; set; } = 0; + public DateTime? ExpireDate { get; set; } = null; + public string Condition { get; set; } = string.Empty; + public string Category { get; set; } = string.Empty; + public string SubCatgory { get; set; } = string.Empty; + public string Status { get; set; } = string.Empty; + public UserView Seller { get; set; } = new(); public List Assets { get; set; } public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } diff --git a/Dentizone.Application/DTOs/Post/UpdatePostDTO.cs b/Dentizone.Application/DTOs/Post/UpdatePostDTO.cs index 13ef1b8..5494fed 100644 --- a/Dentizone.Application/DTOs/Post/UpdatePostDTO.cs +++ b/Dentizone.Application/DTOs/Post/UpdatePostDTO.cs @@ -4,12 +4,12 @@ namespace Dentizone.Application.DTOs.Post { public class UpdatePostDto { - public string Title { get; set; } - public string Description { get; set; } + public required string Title { get; set; } + public required string Description { get; set; } public decimal Price { get; set; } public PostItemCondition Condition { get; set; } - public string Street { get; set; } - public string City { get; set; } + public required string Street { get; set; } + public required string City { get; set; } public PostStatus Status { get; set; } public List AssetIds { get; set; } = new(); diff --git a/Dentizone.Application/DTOs/Q&A/AnswerDTO/AnswerViewDto.cs b/Dentizone.Application/DTOs/Q&A/AnswerDTO/AnswerViewDto.cs index 4ca4fa4..fa45ec2 100644 --- a/Dentizone.Application/DTOs/Q&A/AnswerDTO/AnswerViewDto.cs +++ b/Dentizone.Application/DTOs/Q&A/AnswerDTO/AnswerViewDto.cs @@ -4,9 +4,9 @@ namespace Dentizone.Application.DTOs.Q_A.AnswerDTO { public class AnswerViewDto { - public string Id { get; set; } - public string ResponderName { get; set; } - public string Text { get; set; } + public required string Id { get; set; } + public required string ResponderName { get; set; } + public required string Text { get; set; } public DateTime CreatedAt { get; set; } } diff --git a/Dentizone.Application/DTOs/Q&A/AnswerDTO/CreateAnswerDto.cs b/Dentizone.Application/DTOs/Q&A/AnswerDTO/CreateAnswerDto.cs index c07f497..2236700 100644 --- a/Dentizone.Application/DTOs/Q&A/AnswerDTO/CreateAnswerDto.cs +++ b/Dentizone.Application/DTOs/Q&A/AnswerDTO/CreateAnswerDto.cs @@ -4,7 +4,7 @@ namespace Dentizone.Application.DTOs.Q_A.AnswerDTO { public class CreateAnswerDto { - public string Text { get; set; } + public required string Text { get; set; } } public class CreateAnswerDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Q&A/AnswerDTO/UpdateAnswerDto.cs b/Dentizone.Application/DTOs/Q&A/AnswerDTO/UpdateAnswerDto.cs index e1fb393..0986040 100644 --- a/Dentizone.Application/DTOs/Q&A/AnswerDTO/UpdateAnswerDto.cs +++ b/Dentizone.Application/DTOs/Q&A/AnswerDTO/UpdateAnswerDto.cs @@ -4,7 +4,7 @@ namespace Dentizone.Application.DTOs.Q_A.AnswerDTO { public class UpdateAnswerDto { - public string Text { get; set; } + public required string Text { get; set; } } public class UpdateAnswerDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Q&A/QuestionDTO/CreateQuestionDto.cs b/Dentizone.Application/DTOs/Q&A/QuestionDTO/CreateQuestionDto.cs index 4685c38..b74425c 100644 --- a/Dentizone.Application/DTOs/Q&A/QuestionDTO/CreateQuestionDto.cs +++ b/Dentizone.Application/DTOs/Q&A/QuestionDTO/CreateQuestionDto.cs @@ -6,7 +6,7 @@ namespace Dentizone.Application.DTOs.Q_A.QuestionDTO #nullable enable public class CreateQuestionDto { - public string PostId { get; set; } + public required string PostId { get; set; } public string? Text { get; set; } } diff --git a/Dentizone.Application/DTOs/Q&A/QuestionDTO/QuestionViewDto.cs b/Dentizone.Application/DTOs/Q&A/QuestionDTO/QuestionViewDto.cs index b25559a..951fd84 100644 --- a/Dentizone.Application/DTOs/Q&A/QuestionDTO/QuestionViewDto.cs +++ b/Dentizone.Application/DTOs/Q&A/QuestionDTO/QuestionViewDto.cs @@ -5,9 +5,9 @@ namespace Dentizone.Application.DTOs.Q_A.QuestionDTO { public class QuestionViewDto { - public string Id { get; set; } - public string AskerName { get; set; } - public string Text { get; set; } + public required string Id { get; set; } + public required string AskerName { get; set; } + public required string Text { get; set; } public AnswerViewDto? Answer { get; set; } public DateTime CreatedAt { get; set; } } diff --git a/Dentizone.Application/DTOs/Review/CreateReviewDTO.cs b/Dentizone.Application/DTOs/Review/CreateReviewDTO.cs index 93e3234..405e9a6 100644 --- a/Dentizone.Application/DTOs/Review/CreateReviewDTO.cs +++ b/Dentizone.Application/DTOs/Review/CreateReviewDTO.cs @@ -4,9 +4,9 @@ namespace Dentizone.Application.DTOs.Review { public class CreateReviewDto { - public string OrderId { get; set; } + public required string OrderId { get; set; } public int Stars { get; set; } - public string Comment { get; set; } + public required string Comment { get; set; } } public class CreateReviewDtoValidation : AbstractValidator diff --git a/Dentizone.Application/DTOs/Review/ReviewDTO.cs b/Dentizone.Application/DTOs/Review/ReviewDTO.cs index f8030ff..a8b406c 100644 --- a/Dentizone.Application/DTOs/Review/ReviewDTO.cs +++ b/Dentizone.Application/DTOs/Review/ReviewDTO.cs @@ -4,7 +4,7 @@ namespace Dentizone.Application.DTOs.Review { public class ReviewDto { - public string Comment { get; set; } + public required string Comment { get; set; } public int Stars { get; set; } } diff --git a/Dentizone.Application/DTOs/University/SupportedUniversitiesDTO.cs b/Dentizone.Application/DTOs/University/SupportedUniversitiesDTO.cs index bccc1d9..22fa707 100644 --- a/Dentizone.Application/DTOs/University/SupportedUniversitiesDTO.cs +++ b/Dentizone.Application/DTOs/University/SupportedUniversitiesDTO.cs @@ -2,6 +2,5 @@ { public class SupportedUniversitiesDto : UniversityDto { - public string Id { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/University/University.cs b/Dentizone.Application/DTOs/University/University.cs index 8931a78..d113c1b 100644 --- a/Dentizone.Application/DTOs/University/University.cs +++ b/Dentizone.Application/DTOs/University/University.cs @@ -2,8 +2,8 @@ public class UniversityDto { - public string Id { get; set; } - public string Name { get; set; } - public string Domain { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } + public required string Domain { get; set; } public bool IsSupported { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/University/UniversityView.cs b/Dentizone.Application/DTOs/University/UniversityView.cs index feda1bb..5025a89 100644 --- a/Dentizone.Application/DTOs/University/UniversityView.cs +++ b/Dentizone.Application/DTOs/University/UniversityView.cs @@ -2,9 +2,9 @@ { public class UniversityView { - public string Id { get; set; } - public string Name { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } public bool IsSupported { get; set; } - public string Domain { get; set; } + public required string Domain { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/User/CreateAppUser.cs b/Dentizone.Application/DTOs/User/CreateAppUser.cs index 03c6898..ec80acd 100644 --- a/Dentizone.Application/DTOs/User/CreateAppUser.cs +++ b/Dentizone.Application/DTOs/User/CreateAppUser.cs @@ -4,13 +4,13 @@ namespace Dentizone.Application.DTOs.User { public class CreateAppUser { - public string + public required string Id { get; set; } - public string FullName { get; set; } - public string Email { get; set; } - public string Username { get; set; } - public string UniversityId { get; set; } + public required string FullName { get; set; } + public required string Email { get; set; } + public required string Username { get; set; } + public required string UniversityId { get; set; } public int AcademicYear { get; set; } public KycStatus KycStatus { get; set; } diff --git a/Dentizone.Application/DTOs/User/DomainUser.cs b/Dentizone.Application/DTOs/User/DomainUser.cs index b116f22..16e911c 100644 --- a/Dentizone.Application/DTOs/User/DomainUser.cs +++ b/Dentizone.Application/DTOs/User/DomainUser.cs @@ -3,11 +3,11 @@ public class DomainUserView { public string Id { get; set; } = string.Empty; - public string FullName { get; set; } + public required string FullName { get; set; } public int AcademicYear { get; set; } public long? NationalId { get; set; } - public string KycStatus { get; set; } - public string Status { get; set; } - public string UnversityName { get; set; } + public required string KycStatus { get; set; } + public required string Status { get; set; } + public required string UnversityName { get; set; } public string Username { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/User/LoggedInUser.cs b/Dentizone.Application/DTOs/User/LoggedInUser.cs index cd6f43e..b755352 100644 --- a/Dentizone.Application/DTOs/User/LoggedInUser.cs +++ b/Dentizone.Application/DTOs/User/LoggedInUser.cs @@ -5,6 +5,6 @@ namespace Dentizone.Application.DTOs.User; public class LoggedInUser { - public ApplicationUser User { get; set; } + public required ApplicationUser User { get; set; } public UserRoles Role { get; set; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/User/UserDTO.cs b/Dentizone.Application/DTOs/User/UserDTO.cs index 333d674..29ca58b 100644 --- a/Dentizone.Application/DTOs/User/UserDTO.cs +++ b/Dentizone.Application/DTOs/User/UserDTO.cs @@ -4,16 +4,15 @@ namespace Dentizone.Application.DTOs.User { public class UserDto { - public string - Id - { get; set; } // YES, we're accepting string IDs for user because it's coming from IdentityServer + public required string + Id { get; set; } // YES, we're accepting string IDs for user because it's coming from IdentityServer - public string FullName { get; set; } - public string Username { get; set; } + public required string FullName { get; set; } + public required string Username { get; set; } public int AcademicYear { get; set; } public long? NationalId { get; set; } public KycStatus KycStatus { get; set; } public UserState Status { get; set; } - public string UniversityName { get; set; } + public required string UniversityName { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/User/UserView.cs b/Dentizone.Application/DTOs/User/UserView.cs index 185a6c2..9c2b65d 100644 --- a/Dentizone.Application/DTOs/User/UserView.cs +++ b/Dentizone.Application/DTOs/User/UserView.cs @@ -2,9 +2,9 @@ { public class UserView { - public string Id { get; set; } - public string Username { get; set; } + public string Id { get; set; } = string.Empty; + public string Username { get; set; } = string.Empty; public int AcademicYear { get; set; } - public required string UnversityName { get; set; } + public string UniversityName { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs b/Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs index 380e81d..704f299 100644 --- a/Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs +++ b/Dentizone.Application/DTOs/UserActivity/UniversitiesByUserDto.cs @@ -2,7 +2,7 @@ { public class UniversitiesByUserDto { - public string UniversityName { get; set; } + public required string UniversityName { get; set; } public int StudentCount { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs b/Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs index 05e9fe7..878b1c2 100644 --- a/Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs +++ b/Dentizone.Application/DTOs/UserActivity/UserActivityDTO.cs @@ -5,14 +5,14 @@ namespace Dentizone.Application.DTOs.UserActivity { public class UserActivityDto { - public string Id { get; set; } - public string UserName { get; set; } - public string UserId { get; set; } - public string FingerprintToken { get; set; } - public string Device { get; set; } - public string UserAgent { get; set; } + public required string Id { get; set; } + public required string UserName { get; set; } + public required string UserId { get; set; } + public required string FingerprintToken { get; set; } + public required string Device { get; set; } + public required string UserAgent { get; set; } public DateTime DetectedAt { get; set; } - public string IpAddress { get; set; } + public required string IpAddress { get; set; } public UserActivities ActivityType { get; set; } } diff --git a/Dentizone.Application/DTOs/Withdrawal/ApproveWithdrawalDto.cs b/Dentizone.Application/DTOs/Withdrawal/ApproveWithdrawalDto.cs index 8e91bda..9207cce 100644 --- a/Dentizone.Application/DTOs/Withdrawal/ApproveWithdrawalDto.cs +++ b/Dentizone.Application/DTOs/Withdrawal/ApproveWithdrawalDto.cs @@ -2,6 +2,6 @@ { public class ApproveWithdrawalDto { - public string AdminNote { get; set; } + public required string AdminNote { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestDto.cs b/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestDto.cs index b051717..bc41ad6 100644 --- a/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestDto.cs +++ b/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestDto.cs @@ -5,7 +5,7 @@ namespace Dentizone.Application.DTOs.Withdrawal public class WithdrawalRequestDto { public decimal Amount { get; set; } - public string WalletId { get; set; } + public required string WalletId { get; set; } } public class WithdrawalRequestDtoValidator : AbstractValidator diff --git a/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestView.cs b/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestView.cs index 3baa43a..77b86bc 100644 --- a/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestView.cs +++ b/Dentizone.Application/DTOs/Withdrawal/WithdrawalRequestView.cs @@ -2,12 +2,12 @@ { public class WithdrawalRequestView { - public string Id { get; set; } + public required string Id { get; set; } public decimal Amount { get; set; } - public string WalletId { get; set; } - public string Status { get; set; } - public string UserId { get; set; } + public required string WalletId { get; set; } + public required string Status { get; set; } + public required string UserId { get; set; } - public string AdminNotes { get; set; } + public required string AdminNotes { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Application/Services/Authentication/VerificationService.cs b/Dentizone.Application/Services/Authentication/VerificationService.cs index 51299d6..89da368 100644 --- a/Dentizone.Application/Services/Authentication/VerificationService.cs +++ b/Dentizone.Application/Services/Authentication/VerificationService.cs @@ -10,8 +10,8 @@ namespace Dentizone.Application.Services.Authentication { public class Metadata { - public string Email { get; set; } - public string UserId { get; set; } + public required string Email { get; set; } + public required string UserId { get; set; } } diff --git a/Dentizone.Application/Services/CloudinaryService.cs b/Dentizone.Application/Services/CloudinaryService.cs index a694c8a..d122b32 100644 --- a/Dentizone.Application/Services/CloudinaryService.cs +++ b/Dentizone.Application/Services/CloudinaryService.cs @@ -23,7 +23,8 @@ public string Upload(Stream fileStream, string fileName) throw new CloudinaryUploadException($"Error uploading image: {uploadResult.Error.Message}"); } - return uploadResult.SecureUri.ToString(); + + return uploadResult.SecureUrl.ToString(); } } } \ No newline at end of file diff --git a/Dentizone.Application/Services/Payment/WalletService.cs b/Dentizone.Application/Services/Payment/WalletService.cs index d511e4a..4982bf8 100644 --- a/Dentizone.Application/Services/Payment/WalletService.cs +++ b/Dentizone.Application/Services/Payment/WalletService.cs @@ -8,9 +8,9 @@ namespace Dentizone.Application.Services.Payment { public class WalletView { - public string Id { get; set; } + public required string Id { get; set; } public decimal Balance { get; set; } - public string UserId { get; set; } + public required string UserId { get; set; } public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } } diff --git a/Dentizone.Application/Services/UserActivityService.cs b/Dentizone.Application/Services/UserActivityService.cs index 7916f3f..55248ca 100644 --- a/Dentizone.Application/Services/UserActivityService.cs +++ b/Dentizone.Application/Services/UserActivityService.cs @@ -25,7 +25,8 @@ public async Task CreateAsync(UserActivities activity, UserAgent = requestContextService.GetUserAgent(), Device = requestContextService.GetDeviceType(), ActivityType = activity, - UserId = requestContextService.GetUserId() ?? userId, + UserId = (requestContextService.GetUserId() ?? userId) ?? + throw new InvalidOperationException("Can't find the UserID"), DetectedAt = detectedAt ?? DateTime.UtcNow }; diff --git a/Dentizone.Domain/Entity/Answer.cs b/Dentizone.Domain/Entity/Answer.cs index d7ff42a..8fce7f5 100644 --- a/Dentizone.Domain/Entity/Answer.cs +++ b/Dentizone.Domain/Entity/Answer.cs @@ -6,12 +6,12 @@ namespace Dentizone.Domain.Entity public class Answer : IBaseEntity, IUpdatable, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string QuestionId { get; set; } - public string Text { get; set; } + public required string QuestionId { get; set; } + public required string Text { get; set; } public AnswerStatus Status { get; set; } public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } - public virtual Question Question { get; set; } + public virtual required Question Question { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/AppUser.cs b/Dentizone.Domain/Entity/AppUser.cs index ad9bdd9..8d41f06 100644 --- a/Dentizone.Domain/Entity/AppUser.cs +++ b/Dentizone.Domain/Entity/AppUser.cs @@ -5,20 +5,20 @@ namespace Dentizone.Domain.Entity { public class AppUser : IBaseEntity, IUpdatable, IDeletable { - public string FullName { get; set; } - public string Username { get; set; } + public string FullName { get; set; } = string.Empty; + public string Username { get; set; } = string.Empty; public int AcademicYear { get; set; } - public required string Email { get; set; } + public string Email { get; set; } = string.Empty; public long? NationalId { get; set; } public KycStatus KycStatus { get; set; } public UserState Status { get; set; } public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } - public string UniversityId { get; set; } - public University University { get; set; } - public Wallet Wallet { get; set; } - public ICollection Favourites { get; set; } + public string UniversityId { get; set; } = string.Empty; + public virtual University University { get; set; } = new(); + public Wallet Wallet { get; set; } = new(); + public ICollection Favourites { get; set; } = new List(); public ICollection UserAssets { get; set; } public ICollection UserActivities { get; set; } public ICollection Posts { get; set; } diff --git a/Dentizone.Domain/Entity/Asset.cs b/Dentizone.Domain/Entity/Asset.cs index 6f5874b..3cccd6b 100644 --- a/Dentizone.Domain/Entity/Asset.cs +++ b/Dentizone.Domain/Entity/Asset.cs @@ -6,9 +6,9 @@ namespace Dentizone.Domain.Entity public class Asset : IBaseEntity, IUpdatable, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string Url { get; set; } + public string Url { get; set; } = string.Empty; public long Size { get; set; } - public string UserId { get; set; } + public string UserId { get; set; } = string.Empty; public AssetType Type { get; set; } public DateTime CreatedAt { get; set; } @@ -17,6 +17,6 @@ public class Asset : IBaseEntity, IUpdatable, IDeletable public bool IsDeleted { get; set; } public virtual ICollection UserAssets { get; set; } = new List(); public virtual ICollection PostAssets { get; set; } = new List(); - public virtual AppUser User { get; set; } + public virtual AppUser User { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Cart.cs b/Dentizone.Domain/Entity/Cart.cs index 6d50f77..b65fa86 100644 --- a/Dentizone.Domain/Entity/Cart.cs +++ b/Dentizone.Domain/Entity/Cart.cs @@ -5,14 +5,14 @@ namespace Dentizone.Domain.Entity public class Cart : IBaseEntity, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string UserId { get; set; } - public string PostId { get; set; } + public required string UserId { get; set; } + public required string PostId { get; set; } public DateTime CreatedAt { get; set; } public bool IsDeleted { get; set; } // Navigation properties - public virtual AppUser User { get; set; } + public virtual AppUser User { get; set; } = new(); public virtual Post Post { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Category.cs b/Dentizone.Domain/Entity/Category.cs index 91c4d60..638f1b6 100644 --- a/Dentizone.Domain/Entity/Category.cs +++ b/Dentizone.Domain/Entity/Category.cs @@ -5,9 +5,9 @@ namespace Dentizone.Domain.Entity public class Category : IBaseEntity, IUpdatable, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string Name { get; set; } + public string Name { get; set; } = string.Empty; - public string IconUrl { get; set; } + public string IconUrl { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } diff --git a/Dentizone.Domain/Entity/Favourite.cs b/Dentizone.Domain/Entity/Favourite.cs index f3c239a..010e781 100644 --- a/Dentizone.Domain/Entity/Favourite.cs +++ b/Dentizone.Domain/Entity/Favourite.cs @@ -2,14 +2,14 @@ namespace Dentizone.Domain.Entity { - public class Favourite : IBaseEntity, IDeletable + public class Favourite : IBaseEntity, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string UserId { get; set; } - public string PostId { get; set; } + public required string UserId { get; set; } + public required string PostId { get; set; } public DateTime CreatedAt { get; set; } public bool IsDeleted { get; set; } - public virtual AppUser User { get; set; } - public virtual Post Post { get; set; } + public virtual AppUser User { get; set; } = new(); + public virtual Post Post { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Order.cs b/Dentizone.Domain/Entity/Order.cs index 3769bf4..031e3f6 100644 --- a/Dentizone.Domain/Entity/Order.cs +++ b/Dentizone.Domain/Entity/Order.cs @@ -6,20 +6,20 @@ public class Order : IBaseEntity, IDeletable, IUpdatable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string BuyerId { get; set; } - public AppUser Buyer { get; set; } + public string BuyerId { get; set; } = string.Empty; + public AppUser Buyer { get; set; } = new(); public decimal CommissionAmount { get; set; } public decimal TotalAmount { get; set; } public DateTime? CompletedAt { get; set; } public bool IsReviewed { get; set; } = false; - public virtual ShipInfo ShipInfo { get; set; } + public virtual ShipInfo ShipInfo { get; set; } = new(); public virtual ICollection OrderPickups { get; set; } = new List(); public virtual ICollection OrderItems { get; set; } = new List(); public virtual ICollection OrderStatuses { get; set; } = new List(); public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } - public virtual Review Review { get; set; } + public virtual Review Review { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/OrderItem.cs b/Dentizone.Domain/Entity/OrderItem.cs index e6a4dfd..57578c8 100644 --- a/Dentizone.Domain/Entity/OrderItem.cs +++ b/Dentizone.Domain/Entity/OrderItem.cs @@ -7,10 +7,10 @@ public class OrderItem : IBaseEntity public string Id { get; set; } = Guid.NewGuid().ToString(); public DateTime CreatedAt { get; set; } - public string PostId { get; set; } - public virtual Post Post { get; set; } - public string OrderId { get; set; } - public virtual Order Order { get; set; } + public string PostId { get; set; } = string.Empty; + public virtual Post Post { get; set; } = new(); + public string OrderId { get; set; } = string.Empty; + public virtual Order Order { get; set; } = new(); public ICollection ShipmentActivities { get; set; } = new List(); } diff --git a/Dentizone.Domain/Entity/OrderPickup.cs b/Dentizone.Domain/Entity/OrderPickup.cs index d69f2d5..3e27ac5 100644 --- a/Dentizone.Domain/Entity/OrderPickup.cs +++ b/Dentizone.Domain/Entity/OrderPickup.cs @@ -4,10 +4,10 @@ namespace Dentizone.Domain.Entity { public class OrderPickup : IBaseEntity, IDeletable, IUpdatable { - public string OrderId { get; set; } - public Order Order { get; set; } - public string Street { get; set; } - public string City { get; set; } + public required string OrderId { get; set; } + public required Order Order { get; set; } + public required string Street { get; set; } + public required string City { get; set; } public string Id { get; set; } = Guid.NewGuid().ToString(); public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } diff --git a/Dentizone.Domain/Entity/OrderStatus.cs b/Dentizone.Domain/Entity/OrderStatus.cs index 22b4677..1ffe635 100644 --- a/Dentizone.Domain/Entity/OrderStatus.cs +++ b/Dentizone.Domain/Entity/OrderStatus.cs @@ -8,8 +8,8 @@ public class OrderStatus : IBaseEntity public string Id { get; set; } = Guid.NewGuid().ToString(); public DateTime CreatedAt { get; set; } - public string OrderId { get; set; } - public virtual Order Order { get; set; } + public string OrderId { get; set; } = string.Empty; + public virtual Order Order { get; set; } = new(); public OrderStatues Status { get; set; } public string? Comment { get; set; } diff --git a/Dentizone.Domain/Entity/Payment.cs b/Dentizone.Domain/Entity/Payment.cs index 109169a..0f6a0a1 100644 --- a/Dentizone.Domain/Entity/Payment.cs +++ b/Dentizone.Domain/Entity/Payment.cs @@ -6,8 +6,8 @@ namespace Dentizone.Domain.Entity public class Payment : IBaseEntity, IUpdatable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string OrderId { get; set; } - public string BuyerId { get; set; } + public string OrderId { get; set; } = string.Empty; + public string BuyerId { get; set; } = string.Empty; public decimal Amount { get; set; } public PaymentMethod Method { get; set; } public PaymentStatus Status { get; set; } = PaymentStatus.Pending; @@ -15,8 +15,8 @@ public class Payment : IBaseEntity, IUpdatable // Navigation properties - public virtual AppUser Buyer { get; set; } - public virtual Order Order { get; set; } + public virtual AppUser Buyer { get; set; } = new(); + public virtual Order Order { get; set; } = new(); public virtual ICollection SalesTransactions { get; set; } = new List(); public DateTime UpdatedAt { get; set; } diff --git a/Dentizone.Domain/Entity/Post.cs b/Dentizone.Domain/Entity/Post.cs index cde48bc..849ef07 100644 --- a/Dentizone.Domain/Entity/Post.cs +++ b/Dentizone.Domain/Entity/Post.cs @@ -6,27 +6,27 @@ namespace Dentizone.Domain.Entity public class Post : IBaseEntity, IUpdatable, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string Title { get; set; } - public string Description { get; set; } - public string SellerId { get; set; } + public string Title { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string SellerId { get; set; } = string.Empty; public decimal Price { get; set; } public DateTime? ExpireDate { get; set; } public PostItemCondition Condition { get; set; } public PostStatus Status { get; set; } = PostStatus.Active; - public required string Slug { get; set; } + public string Slug { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } - public string Street { get; set; } - public string City { get; set; } + public string Street { get; set; } = string.Empty; + public string City { get; set; } = string.Empty; public virtual AppUser Seller { get; set; } public virtual ICollection Favourites { get; set; } public virtual ICollection PostAssets { get; set; } = new List(); public virtual ICollection Questions { get; set; } = new List(); - public string CategoryId { set; get; } - public string SubCategoryId { set; get; } - public virtual Category Category { get; set; } - public virtual SubCategory SubCategory { get; set; } - public virtual ICollection Carts { get; set; } = new List(); + public string CategoryId { set; get; } = string.Empty; + public string SubCategoryId { set; get; } = string.Empty; + public virtual Category Category { get; set; } = new(); + public virtual SubCategory SubCategory { get; set; } = new(); + public virtual ICollection Carts { get; set; } = []; } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/PostAsset.cs b/Dentizone.Domain/Entity/PostAsset.cs index fee8e93..e9bef63 100644 --- a/Dentizone.Domain/Entity/PostAsset.cs +++ b/Dentizone.Domain/Entity/PostAsset.cs @@ -2,15 +2,15 @@ namespace Dentizone.Domain.Entity { - public class PostAsset : IBaseEntity, IDeletable, IUpdatable - { - public string Id { get; set; } = Guid.NewGuid().ToString(); - public string PostId { get; set; } - public string AssetId { get; set; } - public DateTime CreatedAt { get; set; } - public DateTime UpdatedAt { get; set; } - public bool IsDeleted { get; set; } - public virtual Post Post { get; set; } - public virtual Asset Asset { get; set; } - } + public class PostAsset : IBaseEntity, IDeletable, IUpdatable + { + public string Id { get; set; } = Guid.NewGuid().ToString(); + public string PostId { get; set; } = string.Empty; + public string AssetId { get; set; } = string.Empty; + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public bool IsDeleted { get; set; } + public virtual Post Post { get; set; } = new(); + public virtual Asset Asset { get; set; } = new(); + } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Question.cs b/Dentizone.Domain/Entity/Question.cs index 8f138d8..a5126a0 100644 --- a/Dentizone.Domain/Entity/Question.cs +++ b/Dentizone.Domain/Entity/Question.cs @@ -6,16 +6,16 @@ namespace Dentizone.Domain.Entity public class Question : IBaseEntity, IUpdatable, IDeletable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string PostId { get; set; } - public string AskerId { get; set; } - public string Text { get; set; } + public required string PostId { get; set; } + public required string AskerId { get; set; } + public required string Text { get; set; } public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } - public virtual Post Post { get; set; } - public virtual Answer Answer { get; set; } + public virtual required Post Post { get; set; } + public virtual required Answer Answer { get; set; } public QuestionStatus Status { get; set; } - public virtual AppUser User { get; set; } + public virtual required AppUser User { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Review.cs b/Dentizone.Domain/Entity/Review.cs index a90f29c..9195593 100644 --- a/Dentizone.Domain/Entity/Review.cs +++ b/Dentizone.Domain/Entity/Review.cs @@ -2,17 +2,17 @@ namespace Dentizone.Domain.Entity { - public class Review : IBaseEntity , IDeletable, IUpdatable + public class Review : IBaseEntity, IDeletable, IUpdatable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string UserId { get; set; } + public string UserId { get; set; } = string.Empty; public int Stars { get; set; } public string? Text { get; set; } - public string OrderId { get; set; } + public string OrderId { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } - public virtual AppUser User { get; set; } - public virtual Order Order { get; set; } + public virtual AppUser User { get; set; } = new(); + public virtual Order Order { get; set; } = new(); public bool IsDeleted { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/SalesTransaction.cs b/Dentizone.Domain/Entity/SalesTransaction.cs index 31ecaa2..ea1e187 100644 --- a/Dentizone.Domain/Entity/SalesTransaction.cs +++ b/Dentizone.Domain/Entity/SalesTransaction.cs @@ -9,14 +9,14 @@ public class SalesTransaction : IBaseEntity, IUpdatable public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } - public string WalletId { get; set; } - public string PaymentId { get; set; } + public string WalletId { get; set; } = string.Empty; + public string PaymentId { get; set; } = string.Empty; public decimal Amount { get; set; } public SaleStatus Status { get; set; } // Navigation properties - public virtual Wallet Wallet { get; set; } - public virtual Payment Payment { get; set; } + public virtual Wallet Wallet { get; set; } = new(); + public virtual Payment Payment { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/ShipInfo.cs b/Dentizone.Domain/Entity/ShipInfo.cs index 9285566..3c8f0cf 100644 --- a/Dentizone.Domain/Entity/ShipInfo.cs +++ b/Dentizone.Domain/Entity/ShipInfo.cs @@ -4,12 +4,12 @@ namespace Dentizone.Domain.Entity { public class ShipInfo : IBaseEntity { - public string Street { get; set; } - public string City { get; set; } - public string OrderId { get; set; } - public virtual Order Order { get; set; } - public string UserId { get; set; } - public virtual AppUser User { get; set; } + public string Street { get; set; } = string.Empty; + public string City { get; set; } = string.Empty; + public string OrderId { get; set; } = string.Empty; + public virtual Order Order { get; set; } = new(); + public string UserId { get; set; } = string.Empty; + public virtual AppUser User { get; set; } = new(); public string Id { get; set; } = Guid.NewGuid().ToString(); diff --git a/Dentizone.Domain/Entity/ShipmentActivity.cs b/Dentizone.Domain/Entity/ShipmentActivity.cs index b03fb5d..e52c168 100644 --- a/Dentizone.Domain/Entity/ShipmentActivity.cs +++ b/Dentizone.Domain/Entity/ShipmentActivity.cs @@ -3,15 +3,15 @@ namespace Dentizone.Domain.Entity { - public class ShipmentActivity : IBaseEntity - { - public string Id { get; set; } = Guid.NewGuid().ToString(); - public string ItemId { get; set; } - public ShipmentActivityStatus Status { get; set; } - public string? ActivityDescription { get; set; } - public DateTime CreatedAt { get; set; } + public class ShipmentActivity : IBaseEntity + { + public string Id { get; set; } = Guid.NewGuid().ToString(); + public string ItemId { get; set; } = string.Empty; + public ShipmentActivityStatus Status { get; set; } + public string ActivityDescription { get; set; } = string.Empty; + public DateTime CreatedAt { get; set; } - public virtual OrderItem Item { get; set; } - } + public virtual OrderItem Item { get; set; } = new(); + } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/SubCategory.cs b/Dentizone.Domain/Entity/SubCategory.cs index d3d6db6..372f9aa 100644 --- a/Dentizone.Domain/Entity/SubCategory.cs +++ b/Dentizone.Domain/Entity/SubCategory.cs @@ -6,14 +6,14 @@ public class SubCategory : IBaseEntity, IDeletable, IUpdatable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } public bool IsDeleted { get; set; } // Relationship: Many SubCategories to One Category - public virtual Category Category { get; set; } - public string CategoryId { get; set; } // Foreign Key for Category + public virtual Category Category { get; set; } = new(); + public string CategoryId { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/University.cs b/Dentizone.Domain/Entity/University.cs index f699634..73475e2 100644 --- a/Dentizone.Domain/Entity/University.cs +++ b/Dentizone.Domain/Entity/University.cs @@ -5,11 +5,11 @@ namespace Dentizone.Domain.Entity public class University : IBaseEntity, IDeletable, IUpdatable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public bool IsSupported { get; set; } = true; public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } - public string Domain { get; set; } + public string Domain { get; set; } = string.Empty; public virtual ICollection Users { get; set; } = new List(); public bool IsDeleted { get; set; } diff --git a/Dentizone.Domain/Entity/UserActivity.cs b/Dentizone.Domain/Entity/UserActivity.cs index a8dc001..5c4623f 100644 --- a/Dentizone.Domain/Entity/UserActivity.cs +++ b/Dentizone.Domain/Entity/UserActivity.cs @@ -6,16 +6,16 @@ namespace Dentizone.Domain.Entity public class UserActivity : IBaseEntity { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string UserId { get; set; } - public string FingerprintToken { get; set; } - public string Device { get; set; } - public string UserAgent { get; set; } + public string UserId { get; set; } = string.Empty; + public string FingerprintToken { get; set; } = string.Empty; + public string Device { get; set; } = string.Empty; + public string UserAgent { get; set; } = string.Empty; public DateTime DetectedAt { get; set; } - public string IpAddress { get; set; } + public required string IpAddress { get; set; } public UserActivities ActivityType { get; set; } - public virtual AppUser User { get; set; } + public virtual AppUser User { get; set; } = new(); public DateTime CreatedAt { get; set; } } diff --git a/Dentizone.Domain/Entity/UserAsset.cs b/Dentizone.Domain/Entity/UserAsset.cs index 929b07d..ab72704 100644 --- a/Dentizone.Domain/Entity/UserAsset.cs +++ b/Dentizone.Domain/Entity/UserAsset.cs @@ -12,11 +12,11 @@ public class UserAsset : IBaseEntity, IDeletable public bool IsDeleted { get; set; } // Every UserAsset is associated with a User - public virtual AppUser User { get; set; } - public string UserId { get; set; } + public virtual required AppUser User { get; set; } + public required string UserId { get; set; } // Every UserAsset is associated with an Asset - public virtual Asset Asset { get; set; } - public string AssetId { get; set; } + public virtual required Asset Asset { get; set; } + public required string AssetId { get; set; } } } \ No newline at end of file diff --git a/Dentizone.Domain/Entity/Wallet.cs b/Dentizone.Domain/Entity/Wallet.cs index 830a48a..621ceef 100644 --- a/Dentizone.Domain/Entity/Wallet.cs +++ b/Dentizone.Domain/Entity/Wallet.cs @@ -15,8 +15,8 @@ public class Wallet : IBaseEntity, IUpdatable // Relationship: One Wallet to One User - public virtual AppUser User { get; set; } - public string UserId { get; set; } + public virtual AppUser User { get; set; } = new(); + public string UserId { get; set; } = string.Empty; public virtual ICollection SalesTransactions { get; set; } = new List(); diff --git a/Dentizone.Domain/Entity/WithdrawalRequest.cs b/Dentizone.Domain/Entity/WithdrawalRequest.cs index fc74d45..3ce20b0 100644 --- a/Dentizone.Domain/Entity/WithdrawalRequest.cs +++ b/Dentizone.Domain/Entity/WithdrawalRequest.cs @@ -6,7 +6,7 @@ namespace Dentizone.Domain.Entity public class WithdrawalRequest : IBaseEntity, IUpdatable { public string Id { get; set; } = Guid.NewGuid().ToString(); - public string WalletId { get; set; } + public string WalletId { get; set; } = string.Empty; public decimal Amount { get; set; } public WithdrawalRequestStatus Status { get; set; } = WithdrawalRequestStatus.Pending; public decimal? ProcessingFee { get; set; } = 0; @@ -18,6 +18,6 @@ public class WithdrawalRequest : IBaseEntity, IUpdatable public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } - public Wallet Wallet { get; set; } // Navigation property to the Wallet entity + public Wallet Wallet { get; set; } = new(); } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/ApiClient/KYC/IdVerification.cs b/Dentizone.Infrastructure/ApiClient/KYC/IdVerification.cs index 74a8dcc..4729be4 100644 --- a/Dentizone.Infrastructure/ApiClient/KYC/IdVerification.cs +++ b/Dentizone.Infrastructure/ApiClient/KYC/IdVerification.cs @@ -4,27 +4,27 @@ namespace Dentizone.Infrastructure.ApiClient.KYC; public partial class IdVerification { - [JsonPropertyName("status")] public string Status { get; set; } + [JsonPropertyName("status")] public required string Status { get; set; } - [JsonPropertyName("document_type")] public string DocumentType { get; set; } + [JsonPropertyName("document_type")] public required string DocumentType { get; set; } - [JsonPropertyName("document_number")] public string DocumentNumber { get; set; } + [JsonPropertyName("document_number")] public required string DocumentNumber { get; set; } - [JsonPropertyName("personal_number")] public string PersonalNumber { get; set; } + [JsonPropertyName("personal_number")] public required string PersonalNumber { get; set; } - [JsonPropertyName("portrait_image")] public Uri PortraitImage { get; set; } + [JsonPropertyName("portrait_image")] public required Uri PortraitImage { get; set; } - [JsonPropertyName("front_image")] public Uri FrontImage { get; set; } + [JsonPropertyName("front_image")] public required Uri FrontImage { get; set; } - [JsonPropertyName("front_video")] public Uri FrontVideo { get; set; } + [JsonPropertyName("front_video")] public required Uri FrontVideo { get; set; } - [JsonPropertyName("back_image")] public Uri BackImage { get; set; } + [JsonPropertyName("back_image")] public required Uri BackImage { get; set; } - [JsonPropertyName("back_video")] public Uri BackVideo { get; set; } + [JsonPropertyName("back_video")] public required Uri BackVideo { get; set; } - [JsonPropertyName("full_front_image")] public Uri FullFrontImage { get; set; } + [JsonPropertyName("full_front_image")] public required Uri FullFrontImage { get; set; } - [JsonPropertyName("full_back_image")] public Uri FullBackImage { get; set; } + [JsonPropertyName("full_back_image")] public required Uri FullBackImage { get; set; } [JsonPropertyName("date_of_birth")] public DateTimeOffset DateOfBirth { get; set; } @@ -34,16 +34,16 @@ public partial class IdVerification [JsonPropertyName("date_of_issue")] public DateTimeOffset DateOfIssue { get; set; } - [JsonPropertyName("issuing_state")] public string IssuingState { get; set; } + [JsonPropertyName("issuing_state")] public required string IssuingState { get; set; } - [JsonPropertyName("full_name")] public string FullName { get; set; } + [JsonPropertyName("full_name")] public required string FullName { get; set; } - [JsonPropertyName("address")] public string Address { get; set; } + [JsonPropertyName("address")] public required string Address { get; set; } - [JsonPropertyName("place_of_birth")] public string PlaceOfBirth { get; set; } + [JsonPropertyName("place_of_birth")] public required string PlaceOfBirth { get; set; } - [JsonPropertyName("nationality")] public string Nationality { get; set; } + [JsonPropertyName("nationality")] public required string Nationality { get; set; } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/ApiClient/KYC/SessionDecisionResponse.cs b/Dentizone.Infrastructure/ApiClient/KYC/SessionDecisionResponse.cs index 9f3d901..b4ad9b2 100644 --- a/Dentizone.Infrastructure/ApiClient/KYC/SessionDecisionResponse.cs +++ b/Dentizone.Infrastructure/ApiClient/KYC/SessionDecisionResponse.cs @@ -8,12 +8,12 @@ public class SessionDecisionResponse [JsonPropertyName("session_number")] public long SessionNumber { get; set; } - [JsonPropertyName("session_url")] public Uri SessionUrl { get; set; } + [JsonPropertyName("session_url")] public required Uri SessionUrl { get; set; } - [JsonPropertyName("status")] public string Status { get; set; } + [JsonPropertyName("status")] public required string Status { get; set; } [JsonPropertyName("vendor_data")] public Guid VendorData { get; set; } - [JsonPropertyName("id_verification")] public IdVerification IdVerification { get; set; } + [JsonPropertyName("id_verification")] public required IdVerification IdVerification { get; set; } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/Persistence/Seeder/UniversitySeeder.cs b/Dentizone.Infrastructure/Persistence/Seeder/UniversitySeeder.cs index a869422..b4afef1 100644 --- a/Dentizone.Infrastructure/Persistence/Seeder/UniversitySeeder.cs +++ b/Dentizone.Infrastructure/Persistence/Seeder/UniversitySeeder.cs @@ -7,59 +7,52 @@ public static class UniversitySeeder public static async Task SeedAsync(AppDbContext context) { var universities = new List - { - new University - { Name = "Arab Academy for Science & Technology", Domain = "aast.edu" }, - new University { Name = "Akhbar El Yom Academy", Domain = "akhbaracademy.edu.eg" }, - new University { Name = "Alexandria University", Domain = "alex.edu.eg" }, - new University { Name = "Arab Open University", Domain = "aou.edu.eg" }, - new University { Name = "American University in Cairo", Domain = "aucegypt.edu" }, - new University { Name = "Assiut University", Domain = "aun.edu.eg" }, - new University { Name = "Al Azhar University", Domain = "azhar.edu.eg" }, - new University { Name = "Beni Suef University", Domain = "bsu.edu.eg" }, - new University { Name = "Benha University", Domain = "bu.edu.eg" }, - new University { Name = "Cairo University", Domain = "cu.edu.eg" }, - new University { Name = "Damanhour University", Domain = "damanhour.edu.eg" }, - new University { Name = "Damietta University", Domain = "du.edu.eg" }, - new University { Name = "El Shorouk Academy", Domain = "elshoroukacademy.edu.eg" }, - new University { Name = "Fayoum University", Domain = "fayoum.edu.eg" }, - new University { Name = "Future University", Domain = "futureuniversity.edu.eg" }, - new University { Name = "German University in Cairo", Domain = "guc.edu.eg" }, - new University { Name = "Helwan University", Domain = "helwan.edu.eg" }, - new University { Name = "Higher Technological Institute", Domain = "hti.edu.eg" }, - new University { Name = "Kafr El-Sheikh University", Domain = "kfs.edu.eg" }, - new University { Name = "Mansoura University", Domain = "mans.edu.eg" }, - new University { Name = "Menoufia University", Domain = "menofia.edu.eg" }, - new University { Name = "Minia University", Domain = "minia.edu.eg" }, - new University - { Name = "Misr International University", Domain = "miuegypt.edu.eg" }, - new University { Name = "Modern Acadmy", Domain = "modern-academy.edu.eg" }, - new University { Name = "Modern Sciences & Arts University", Domain = "msa.eun.eg" }, - new University { Name = "Military Technical College", Domain = "mtc.edu.eg" }, - new University - { Name = "Modern University For Technology and Information", Domain = "mti.edu.eg" }, - new University - { Name = "Misr University for Sience and Technology", Domain = "must.edu.eg" }, - new University { Name = "Nile University", Domain = "nileu.edu.eg" }, - new University { Name = "October 6 university", Domain = "o6u.edu.eg" }, - new University { Name = "Pharos International University", Domain = "pua.edu.eg" }, - new University - { Name = "Sadat Academy for Management Sciences", Domain = "sadatacademy.edu.eg" }, - new University { Name = "Ain Shams University", Domain = "shams.edu.eg" }, - new University { Name = "Sohag University", Domain = "sohag-univ.edu.eg" }, - new University { Name = "Sinai University", Domain = "su.edu.eg" }, - new University { Name = "Suez Canal University", Domain = "suez.edu.eg" }, - new University { Name = "South Valley University", Domain = "svu.edu.eg" }, - new University { Name = "Tanta University", Domain = "tanta.edu.eg" }, - new University { Name = "Université Française d'Égypte", Domain = "ufe.edu.eg" }, - new University - { Name = "Université Senghor d'Alexandrie", Domain = "usenghor-francophonie.org" }, - new University { Name = "Zagazig University", Domain = "zu.edu.eg" }, - new University - { Name = "CIC - Canadian International College", Domain = "cic-cairo.com" }, - new University { Name = "Deraya University", Domain = "deraya.edu.eg" }, - new University { Name = "Badr University in Cairo", Domain = "buc.edu.eg" } - }; + { + new() { Name = "Arab Academy for Science & Technology", Domain = "aast.edu" }, + new() { Name = "Akhbar El Yom Academy", Domain = "akhbaracademy.edu.eg" }, + new() { Name = "Alexandria University", Domain = "alex.edu.eg" }, + new() { Name = "Arab Open University", Domain = "aou.edu.eg" }, + new() { Name = "American University in Cairo", Domain = "aucegypt.edu" }, + new() { Name = "Assiut University", Domain = "aun.edu.eg" }, + new() { Name = "Al Azhar University", Domain = "azhar.edu.eg" }, + new() { Name = "Beni Suef University", Domain = "bsu.edu.eg" }, + new() { Name = "Benha University", Domain = "bu.edu.eg" }, + new() { Name = "Cairo University", Domain = "cu.edu.eg" }, + new() { Name = "Damanhour University", Domain = "damanhour.edu.eg" }, + new() { Name = "Damietta University", Domain = "du.edu.eg" }, + new() { Name = "El Shorouk Academy", Domain = "elshoroukacademy.edu.eg" }, + new() { Name = "Fayoum University", Domain = "fayoum.edu.eg" }, + new() { Name = "Future University", Domain = "futureuniversity.edu.eg" }, + new() { Name = "German University in Cairo", Domain = "guc.edu.eg" }, + new() { Name = "Helwan University", Domain = "helwan.edu.eg" }, + new() { Name = "Higher Technological Institute", Domain = "hti.edu.eg" }, + new() { Name = "Kafr El-Sheikh University", Domain = "kfs.edu.eg" }, + new() { Name = "Mansoura University", Domain = "mans.edu.eg" }, + new() { Name = "Menoufia University", Domain = "menofia.edu.eg" }, + new() { Name = "Minia University", Domain = "minia.edu.eg" }, + new() { Name = "Misr International University", Domain = "miuegypt.edu.eg" }, + new() { Name = "Modern Acadmy", Domain = "modern-academy.edu.eg" }, + new() { Name = "Modern Sciences & Arts University", Domain = "msa.eun.eg" }, + new() { Name = "Military Technical College", Domain = "mtc.edu.eg" }, + new() { Name = "Modern University For Technology and Information", Domain = "mti.edu.eg" }, + new() { Name = "Misr University for Sience and Technology", Domain = "must.edu.eg" }, + new() { Name = "Nile University", Domain = "nileu.edu.eg" }, + new() { Name = "October 6 university", Domain = "o6u.edu.eg" }, + new() { Name = "Pharos International University", Domain = "pua.edu.eg" }, + new() { Name = "Sadat Academy for Management Sciences", Domain = "sadatacademy.edu.eg" }, + new() { Name = "Ain Shams University", Domain = "shams.edu.eg" }, + new() { Name = "Sohag University", Domain = "sohag-univ.edu.eg" }, + new() { Name = "Sinai University", Domain = "su.edu.eg" }, + new() { Name = "Suez Canal University", Domain = "suez.edu.eg" }, + new() { Name = "South Valley University", Domain = "svu.edu.eg" }, + new() { Name = "Tanta University", Domain = "tanta.edu.eg" }, + new() { Name = "Université Française d'Égypte", Domain = "ufe.edu.eg" }, + new() { Name = "Université Senghor d'Alexandrie", Domain = "usenghor-francophonie.org" }, + new() { Name = "Zagazig University", Domain = "zu.edu.eg" }, + new() { Name = "CIC - Canadian International College", Domain = "cic-cairo.com" }, + new() { Name = "Deraya University", Domain = "deraya.edu.eg" }, + new() { Name = "Badr University in Cairo", Domain = "buc.edu.eg" } + }; await context.Universities.AddRangeAsync(universities); await context.SaveChangesAsync(); diff --git a/Dentizone.Infrastructure/Repositories/AnswerRepository.cs b/Dentizone.Infrastructure/Repositories/AnswerRepository.cs index 2e4b789..6414a09 100644 --- a/Dentizone.Infrastructure/Repositories/AnswerRepository.cs +++ b/Dentizone.Infrastructure/Repositories/AnswerRepository.cs @@ -15,8 +15,9 @@ public async Task CreateAsync(Answer entity) } - public async Task FindBy(Expression> condition, - Expression>[]? includes) + public async Task FindBy( + Expression> condition, + Expression>[]? includes = null) { var query = DbContext.Answers.AsQueryable(); @@ -24,13 +25,11 @@ public async Task CreateAsync(Answer entity) return await DbContext.Answers .FirstOrDefaultAsync(condition); - foreach (var include in includes) { query = query.Include(include); } - return await query .FirstOrDefaultAsync(condition); } diff --git a/Dentizone.Infrastructure/Secret/SecretService.cs b/Dentizone.Infrastructure/Secret/SecretService.cs index 72b854c..778f7a0 100644 --- a/Dentizone.Infrastructure/Secret/SecretService.cs +++ b/Dentizone.Infrastructure/Secret/SecretService.cs @@ -8,7 +8,7 @@ internal class GetSecret : GetSecretOptions { public GetSecret() { - Environment = System.Environment.GetEnvironmentVariable("env") ?? "unknown"; + Environment = System.Environment.GetEnvironmentVariable("env") ?? "dev"; ProjectId = System.Environment.GetEnvironmentVariable("ProjectId") ?? throw new ArgumentNullException("Can't find the project id"); } diff --git a/Dentizone.Presentaion/Controllers/AdminController.cs b/Dentizone.Presentaion/Controllers/AdminController.cs deleted file mode 100644 index 8154299..0000000 --- a/Dentizone.Presentaion/Controllers/AdminController.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Dentizone.Application.Interfaces; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace Dentizone.Presentaion.Controllers -{ - [Route("api/[controller]")] - [Authorize("IsAdmin")] - [ApiController] - public class AdminController(IWithdrawalService withdrawalService) : ControllerBase - { - [HttpPost("withdrawal/{id}/approve")] - public async Task ApproveWithdrawal(string id) - { - var approvedRequest = await withdrawalService.ApproveWithdrawalAsync(id, "adminNote"); - - return Ok(approvedRequest); - } - - [HttpPost("withdrawal/{id}/reject")] - public async Task RejectWithdrawal(string id) - { - var rejectedRequest = await withdrawalService.RejectWithdrawalAsync(id, "adminNote"); - return Ok(rejectedRequest); - } - } -} \ No newline at end of file diff --git a/Dentizone.Presentaion/Controllers/WalletController.cs b/Dentizone.Presentaion/Controllers/WalletController.cs index e9379de..3987810 100644 --- a/Dentizone.Presentaion/Controllers/WalletController.cs +++ b/Dentizone.Presentaion/Controllers/WalletController.cs @@ -38,5 +38,22 @@ public async Task GetWithdrawalHistory(int page = 1) var history = await withdrawalService.GetWithdrawalHistoryAsync(userId, page); return Ok(history); } + + [Authorize("IsAdmin")] + [HttpPost("withdrawal/{id}/approve")] + public async Task ApproveWithdrawal(string id, [FromBody] string note = "") + { + var approvedRequest = await withdrawalService.ApproveWithdrawalAsync(id, note); + + return Ok(approvedRequest); + } + + [Authorize("IsAdmin")] + [HttpPost("withdrawal/{id}/reject")] + public async Task RejectWithdrawal(string id, [FromBody] string note = "") + { + var rejectedRequest = await withdrawalService.RejectWithdrawalAsync(id, note); + return Ok(rejectedRequest); + } } } \ No newline at end of file diff --git a/Dentizone.sln.DotSettings b/Dentizone.sln.DotSettings index f7714b9..2575201 100644 --- a/Dentizone.sln.DotSettings +++ b/Dentizone.sln.DotSettings @@ -1,2 +1,3 @@  - True \ No newline at end of file + True + True \ No newline at end of file From 15fe0d7c372abc3e06f701f040c012f6594bdec4 Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 22:23:29 +0300 Subject: [PATCH 8/9] Refactor withdrawal history methods to remove pagination - Updated `IWithdrawalService` and `WithdrawalService` to remove the `page` parameter from `GetWithdrawalHistoryAsync`. - Simplified `UserActivityService` by cleaning up `UserId` retrieval logic. - Modified `IWithdrawalRequestRepository` and `WithdrawalRequestRepository` to eliminate pagination in `GetAllAsync`. - Adjusted `WalletController` to align with the updated service method signatures. --- Dentizone.Application/Interfaces/IWithdrawalService.cs | 2 +- Dentizone.Application/Services/UserActivityService.cs | 3 +-- Dentizone.Application/Services/WithdrawalService.cs | 4 ++-- .../Repositories/IWithdrawalRequestRepository.cs | 9 +++------ .../Repositories/WithdrawalRequestRepository.cs | 3 +-- Dentizone.Presentaion/Controllers/WalletController.cs | 2 +- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Dentizone.Application/Interfaces/IWithdrawalService.cs b/Dentizone.Application/Interfaces/IWithdrawalService.cs index 9124433..144ec23 100644 --- a/Dentizone.Application/Interfaces/IWithdrawalService.cs +++ b/Dentizone.Application/Interfaces/IWithdrawalService.cs @@ -7,7 +7,7 @@ public interface IWithdrawalService Task CreateWithdrawalRequestAsync(string userId, WithdrawalRequestDto withdrawalRequestDto); - Task> GetWithdrawalHistoryAsync(string userId, int page); + Task> GetWithdrawalHistoryAsync(string userId); Task ApproveWithdrawalAsync(string id, string adminNote); Task RejectWithdrawalAsync(string id, string adminNote); } diff --git a/Dentizone.Application/Services/UserActivityService.cs b/Dentizone.Application/Services/UserActivityService.cs index 55248ca..7916f3f 100644 --- a/Dentizone.Application/Services/UserActivityService.cs +++ b/Dentizone.Application/Services/UserActivityService.cs @@ -25,8 +25,7 @@ public async Task CreateAsync(UserActivities activity, UserAgent = requestContextService.GetUserAgent(), Device = requestContextService.GetDeviceType(), ActivityType = activity, - UserId = (requestContextService.GetUserId() ?? userId) ?? - throw new InvalidOperationException("Can't find the UserID"), + UserId = requestContextService.GetUserId() ?? userId, DetectedAt = detectedAt ?? DateTime.UtcNow }; diff --git a/Dentizone.Application/Services/WithdrawalService.cs b/Dentizone.Application/Services/WithdrawalService.cs index 69150ca..e34e754 100644 --- a/Dentizone.Application/Services/WithdrawalService.cs +++ b/Dentizone.Application/Services/WithdrawalService.cs @@ -47,13 +47,13 @@ public async Task CreateWithdrawalRequestAsync( return withdrawalView; } - public async Task> GetWithdrawalHistoryAsync(string userId, int page) + public async Task> GetWithdrawalHistoryAsync(string userId) { var wallet = await walletService.GetWalletByUserIdAsync(userId); if (wallet == null) throw new NotFoundException("Wallet not found."); - var withdrawalRequests = await withdrawalRepo.GetAllAsync(page, w => w.WalletId == wallet.Id); + var withdrawalRequests = await withdrawalRepo.GetAllAsync(w => w.WalletId == wallet.Id); if (!withdrawalRequests.Any()) { return []; diff --git a/Dentizone.Domain/Interfaces/Repositories/IWithdrawalRequestRepository.cs b/Dentizone.Domain/Interfaces/Repositories/IWithdrawalRequestRepository.cs index 0eb334b..a9a23fb 100644 --- a/Dentizone.Domain/Interfaces/Repositories/IWithdrawalRequestRepository.cs +++ b/Dentizone.Domain/Interfaces/Repositories/IWithdrawalRequestRepository.cs @@ -6,11 +6,8 @@ namespace Dentizone.Domain.Interfaces.Repositories public interface IWithdrawalRequestRepository : IBaseRepo { Task UpdateAsync(WithdrawalRequest entity); - Task DeleteAsync(string id); - Task GetByIdAsync(string id); - Task CreateAsync(WithdrawalRequest entity); - public Task FindBy(Expression> condition, - Expression>[]? includes); - public Task> GetAllAsync(int page, Expression>? condition = null); + + Task> GetAllAsync( + Expression>? condition); } } \ No newline at end of file diff --git a/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs b/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs index 7e34045..5d8dad1 100644 --- a/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs +++ b/Dentizone.Infrastructure/Repositories/WithdrawalRequestRepository.cs @@ -31,7 +31,7 @@ public async Task CreateAsync(WithdrawalRequest entity) } public async Task> GetAllAsync( - int page, Expression>? condition) + Expression>? condition) { IQueryable query = dbContext.WithdrawalRequests; if (condition != null) @@ -41,7 +41,6 @@ public async Task> GetAllAsync( return await query .OrderByDescending(u => u.CreatedAt) - .Skip(CalculatePagination(page)) .Take(DefaultPageSize) .ToListAsync(); } diff --git a/Dentizone.Presentaion/Controllers/WalletController.cs b/Dentizone.Presentaion/Controllers/WalletController.cs index 3987810..ebc5a90 100644 --- a/Dentizone.Presentaion/Controllers/WalletController.cs +++ b/Dentizone.Presentaion/Controllers/WalletController.cs @@ -35,7 +35,7 @@ public async Task RequestWithdrawal([FromBody] WithdrawalRequestD public async Task GetWithdrawalHistory(int page = 1) { var userId = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; - var history = await withdrawalService.GetWithdrawalHistoryAsync(userId, page); + var history = await withdrawalService.GetWithdrawalHistoryAsync(userId); return Ok(history); } From 219ebc04a18f0f190c6ad92f2e316df5d00e43cc Mon Sep 17 00:00:00 2001 From: Mahmoud Nasr <239.nasr@gmail.com> Date: Sun, 29 Jun 2025 22:31:18 +0300 Subject: [PATCH 9/9] Update Dentizone.Application/AssemblyReference.cs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- Dentizone.Application/AssemblyReference.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dentizone.Application/AssemblyReference.cs b/Dentizone.Application/AssemblyReference.cs index 58a1b1e..ec6ba79 100644 --- a/Dentizone.Application/AssemblyReference.cs +++ b/Dentizone.Application/AssemblyReference.cs @@ -1,5 +1,9 @@ namespace Dentizone.Application { + /// + /// Marker interface for the Application assembly, + /// used by AutoMapper to locate and load its profiles. + /// public interface IAssemblyReference { }