├── .githooks └── commit-msg ├── .github ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── ci-build-lint-test.yml │ ├── dev-deployment.yml │ ├── production-deployment.yml │ └── staging-deployment.yml ├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── Dockerfile ├── Hng.Csharp.Web.sln ├── LICENSE ├── README.md ├── SECURITY.md ├── TestConsole ├── Program.cs └── TestConsole.csproj ├── docker-compose.prod.yml ├── docker-compose.staging.yml ├── docker-compose.yml ├── ing Hng.Infrastructure.Repository.Interface ├── nginx.conf ├── scripts ├── dev-deploy.sh ├── prod-deploy.sh └── staging-deploy.sh └── src ├── Hng.Application.Test ├── Features │ ├── ApiStatuses │ │ ├── CreateApiStatusCommandShould.cs │ │ └── GetAllStatusApiQueryShould.cs │ ├── BillingPlans │ │ ├── CreateBillingPlanCommandShould.cs │ │ ├── DeleteBillingPlanCommandShould.cs │ │ ├── GetAllBillingPlansQueryShould.cs │ │ ├── GetBillingPlanByIdQueryShould.cs │ │ └── UpdateBillingPlanCommandShould.cs │ ├── Blog │ │ ├── CreateBlogCommandShould.cs │ │ ├── DeleteBlogByIdCommandShould.cs │ │ ├── GetBlogByIdQueryShould.cs │ │ ├── GetBlogsQueryShould.cs │ │ └── UpdateBlogCommandShould.cs │ ├── Categories │ │ ├── CreateCategoryCommandHandlerShould.cs │ │ ├── DeleteCategoryCommandHandlerShould.cs │ │ ├── GetAllCategoriesQueryHandlerShould.cs │ │ └── GetCategoryByIdQueryHandlerShould.cs │ ├── Comment │ │ ├── CreateCommentCommandShould.cs │ │ └── GetCommentsByBlogIdShould.cs │ ├── Contacts │ │ ├── CreateContactUsCommandShould.cs │ │ ├── DeleteContactUsCommandShould.cs │ │ └── GetAllContactUsQueryShould.cs │ ├── Dashboard │ │ ├── GetDashboardQueryShould.cs │ │ ├── GetExportDataQueryShould.cs │ │ ├── GetNavigationDataQueryShould.cs │ │ └── GetSalesTrendQueryShould.cs │ ├── Faqs │ │ ├── CreateFaqCommandShould.cs │ │ ├── DeleteFaqCommandShould.cs │ │ └── UpdateFaqCommandShould.cs │ ├── HelpCenter │ │ ├── CreateHelpCenterTopicCommandShould.cs │ │ ├── DeleteHelpCenterTopicCommandShould.cs │ │ ├── GetAllHelpCenterTopicsQueryShould.cs │ │ ├── GetHelpCenterTopicByIdQueryShould.cs │ │ ├── HelpCenterTopicsTestsSetup.cs │ │ ├── SearchHelpCenterTopicsQueryShould.cs │ │ └── UpdateHelpCenterTopicCommandShould.cs │ ├── Job │ │ ├── CreateJobCommandShould.cs │ │ ├── DeleteJobByIdCommandShould.cs │ │ ├── GetJobByIdQueryShould.cs │ │ ├── GetJobsQueryShould.cs │ │ └── UpdateJobCommandShould.cs │ ├── Languages │ │ ├── CreateLanguageCommandShould.cs │ │ ├── DeleteLanguageCommandShould.cs │ │ ├── GetAllLanguagesQueryShould.cs │ │ ├── GetLanguageByIdQueryShould.cs │ │ └── UpdateLanguageCommandShould.cs │ ├── NewsLetterSubscription │ │ ├── AddSubscriberCommandHandlerShould.cs │ │ └── DeleteSubscriberCommandHandlerShould.cs │ ├── Notifications │ │ ├── CreateNotificationCommandHandlerShould.cs │ │ ├── CreateNotificationSettingsHandlerShould.cs │ │ ├── DeleteAllNotificationsCommandHandlerShould.cs │ │ ├── DeleteNotificationByIdCommandHandlerShould.cs │ │ ├── GetAllNotificationsHandlerShould.cs │ │ ├── GetNotificationSettingsHandlerShould.cs │ │ ├── GetNotificationsHandlerShould.cs │ │ ├── MarkAllCommandHandlerShould.cs │ │ └── UpdateNotificationCommandHandlerShould.cs │ ├── Organization │ │ ├── CreateOrganizationShould.cs │ │ ├── DeleteUserOrganizationCommandHandlerShould.cs │ │ ├── GetAllUsersQueryHandlerShould.cs │ │ ├── GetOrganizationByIdQueryShould.cs │ │ └── UpdateOrganizationShould.cs │ ├── OrganizationInvite │ │ ├── CreateAndSendInvitesCommandHandlerShould.cs │ │ └── RequestValidatorShould.cs │ ├── PaymentIntegrations │ │ └── Paystack │ │ │ ├── FakeHttpMessageHandler.cs │ │ │ ├── GetTransactionsByProductIdQueryShould.cs │ │ │ ├── GetTransactionsByUserIdQueryShould.cs │ │ │ ├── InitializeTransaction.cs │ │ │ ├── PaystackClientTests.cs │ │ │ ├── SubscriptionTransactionSuccessfulShould.cs │ │ │ ├── TransactionSuccessfulShould.cs │ │ │ └── VerifyTransactionQueryShould.cs │ ├── Products │ │ ├── AddProductsShould.cs │ │ ├── CreateProductShould.cs │ │ ├── DeleteProductByIdCommandShould.cs │ │ ├── GetAllProductsShould.cs │ │ ├── GetCategoriesQueryShould.cs │ │ ├── GetProductByIdQueryShould.cs │ │ ├── GetProductByNameQueryShould.cs │ │ ├── GetUserProductsQueryShould.cs │ │ └── UpdateProductShould.cs │ ├── Profile │ │ ├── UpdateProfileHandlerShould.cs │ │ └── UpdateProfilePictureHandlerShould.cs │ ├── Roles │ │ ├── AssignRolesCommandShould.cs │ │ ├── CreateRoleCommandShould.cs │ │ ├── DeleteRoleCommandShould.cs │ │ ├── GetRoleByIdQueryShould.cs │ │ ├── GetRolePermissionsQueryShould.cs │ │ ├── GetRolesQueryShould.cs │ │ └── UpdateRoleCommandShould.cs │ ├── Squeeze │ │ └── CreateSqueezeShould.cs │ ├── Subscriptions │ │ ├── CreateFreeSubscriptionPlanShould.cs │ │ ├── GetSubscriptionByOrganizationIdShould.cs │ │ └── GetSubscriptionByUserIdShould.cs │ ├── SuperAdmin │ │ └── GetUsersBySearchQueryHandlerShould.cs │ ├── Timezones │ │ ├── CreateTimezoneShould.cs │ │ ├── GetAllTimezonesShould.cs │ │ └── UpdateTimezoneShould.cs │ ├── UserManagement │ │ ├── FacebookLoginCommandShould.cs │ │ ├── GetCurrentlyLoggedInUserDetailsShould.cs │ │ ├── GetUserByIdQueryShould.cs │ │ ├── GetUsersQueryShould.cs │ │ ├── GoogleLoginCommandHandlerTests.cs │ │ ├── LoginUserCommandShould.cs │ │ ├── SwitchOrganisationCommandShould.cs │ │ ├── UpdatePasswordShould.cs │ │ └── UserSignUpCommandShould.cs │ └── WaitLists │ │ ├── CreateWaitlistCommandHandlerShould.cs │ │ ├── DeleteWaitlistByIdCommandHandlerShould.cs │ │ └── GetAllWaitlistQueryHandlerShould.cs ├── Hng.Application.Test.csproj └── TestSetupShould.cs ├── Hng.Application ├── ConfigureApplication.cs ├── Features │ ├── ApiStatuses │ │ ├── Commands │ │ │ └── CreateApiStatusCommand.cs │ │ ├── Dtos │ │ │ ├── Requests │ │ │ │ ├── ApiStatusWrapper.cs │ │ │ │ ├── GetAllApiStatusesQueries.cs │ │ │ │ └── UpdateApiStatusDto.cs │ │ │ └── Responses │ │ │ │ ├── ApiStatusResponseDto.cs │ │ │ │ └── ApiStatusResponseModel.cs │ │ ├── Handlers │ │ │ ├── Commands │ │ │ │ ├── CreateApiStatusCommandHandler.cs │ │ │ │ └── UpdateApiStatusHandler.cs │ │ │ └── Queries │ │ │ │ └── GetAllApiStatusesHandler.cs │ │ └── Mappers │ │ │ └── ApiStatusesMapperProfile.cs │ ├── BillingPlans │ │ ├── Commands │ │ │ ├── CreateBillingPlanCommand.cs │ │ │ ├── DeleteBillingPlanCommand.cs │ │ │ └── UpdateBillingPlanCommand.cs │ │ ├── Dtos │ │ │ ├── BillingPlanDto.cs │ │ │ └── CreateBillingPlanDto.cs │ │ ├── Handlers │ │ │ ├── Commands │ │ │ │ ├── CreateBillingPlanCommandHandler.cs │ │ │ │ ├── DeleteBillingPlanCommandHandler.cs │ │ │ │ └── UpdateBillingPlanCommandHandler.cs │ │ │ └── Queries │ │ │ │ ├── GetAllBillingPlansQueryHandler.cs │ │ │ │ └── GetBillingPlanByIdQueryHandler.cs │ │ ├── Mappers │ │ │ └── BillingPlanMapperProfile.cs │ │ └── Queries │ │ │ ├── GetAllBillingPlansQuery.cs │ │ │ └── GetBillingPlanByIdQuery.cs │ ├── Blogs │ │ ├── Commands │ │ │ ├── CreateBlogCommand.cs │ │ │ ├── DeleteBlogByIdCommand.cs │ │ │ └── UpdateBlogCommand.cs │ │ ├── Dtos │ │ │ ├── BlogDto.cs │ │ │ ├── CreateBlogDto.cs │ │ │ ├── CreateBlogResponseDto.cs │ │ │ ├── GetBlogResponseDto.cs │ │ │ ├── UpdateBlogDto.cs │ │ │ └── UpdateBlogResponseDto.cs │ │ ├── Handlers │ │ │ ├── CreateBlogCommandHandler.cs │ │ │ ├── DeleteBlogByIdCommandHandler.cs │ │ │ ├── GetBlogByIdQueryHandler.cs │ │ │ ├── GetBlogsQueryHandler.cs │ │ │ └── UpdateBlogCommandHandler.cs │ │ ├── Mappers │ │ │ └── BlogMapperProfile.cs │ │ └── Queries │ │ │ ├── GetBlogByIdQuery.cs │ │ │ └── GetBlogsQuery.cs │ ├── Categories │ │ ├── Commands │ │ │ ├── CreateCategoryCommand.cs │ │ │ └── DeleteCategoryCommand.cs │ │ ├── Dtos │ │ │ ├── CategoryDto.cs │ │ │ ├── CategoryListDto.cs │ │ │ ├── CreateCategoryDto.cs │ │ │ └── GetAllCategoriesQueryParams.cs │ │ ├── Handlers │ │ │ ├── Commands │ │ │ │ ├── CreateCategoryCommandHandler.cs │ │ │ │ └── DeleteCategoryCommandHandler.cs │ │ │ └── Queries │ │ │ │ ├── GetAllCategoriesQueryHandler.cs │ │ │ │ ├── GetCategoriesQueryHandler.cs │ │ │ │ └── GetCategoryByIdQueryHandler.cs │ │ ├── Mappers │ │ │ └── CategoryMapperProfile.cs │ │ └── Queries │ │ │ ├── GetAllCategoriesQuery.cs │ │ │ ├── GetCategoriesQuery.cs │ │ │ └── GetCategoryByIdQuery.cs │ ├── Comments │ │ ├── Commands │ │ │ └── CreateCommentCommand.cs │ │ ├── Dtos │ │ │ ├── CommentDto.cs │ │ │ └── CreateCommentDto.cs │ │ ├── Handlers │ │ │ ├── CreateCommentCommandHandler.cs │ │ │ └── GetCommentsByBlogIdQueryHandler.cs │ │ ├── Mappers │ │ │ └── CommentMapperProfile.cs │ │ └── Queries │ │ │ └── GetCommentsByBlogIdQuery.cs │ ├── ContactsUs │ │ ├── Command │ │ │ ├── CreateContactUsCommand.cs │ │ │ └── DeleteContactUsCommand.cs │ │ ├── Dtos │ │ │ ├── ContactResponse.cs │ │ │ ├── ContactUsRequestDto.cs │ │ │ └── ContactUsResponseDto.cs │ │ ├── Handlers │ │ │ ├── CreateContactUsCommandHandler.cs │ │ │ ├── DeleteContactUsCommandHandler.cs │ │ │ └── GetAllContactUsQueryHandler.cs │ │ ├── Mappers │ │ │ └── ContactUsMappingProfile.cs │ │ └── Queries │ │ │ └── GetAllContactUsQuery.cs │ ├── Dashboard │ │ ├── Dtos │ │ │ ├── DashboardDto.cs │ │ │ ├── NavigationDataDto.cs │ │ │ └── SalesTrendQueryParameter.cs │ │ ├── Handlers │ │ │ ├── GetDashboardQueryHandler.cs │ │ │ ├── GetExportDataQueryHandler.cs │ │ │ ├── GetNavigationDataQueryHandler.cs │ │ │ └── GetSalesTrendQueryHandler.cs │ │ ├── Mappers │ │ │ └── DashboardMapperProfile.cs │ │ └── Queries │ │ │ ├── GetDashboardQuery.cs │ │ │ ├── GetExportDataQuery.cs │ │ │ ├── GetNavigationDataQuery.cs │ │ │ └── GetSalesTrendQuery.cs │ ├── EmailTemplates │ │ ├── Commands │ │ │ └── CreateEmailTemplateCommand.cs │ │ ├── DTOs │ │ │ ├── CreateEmailTemplateDTO.cs │ │ │ └── EmailTemplateDTO.cs │ │ ├── Handlers │ │ │ ├── CreateEmailTemplateCommandHandler.cs │ │ │ └── GetAllEmailTemplatesQueryHandler.cs │ │ ├── Mappers │ │ │ └── EmailTemplateMapperProfile.cs │ │ └── Queries │ │ │ └── GetAllEmailTemplatesQuery.cs │ ├── ExternalIntegrations │ │ ├── FilesUploadIntegrations │ │ │ └── Cloudinary │ │ │ │ └── Services │ │ │ │ ├── IImageService.cs │ │ │ │ └── ImageService.cs │ │ └── PaymentIntegrations │ │ │ └── Paystack │ │ │ ├── Dtos │ │ │ ├── Requests │ │ │ │ ├── ErrorResponse.cs │ │ │ │ ├── GetTransactionsByProductIdQuery.cs │ │ │ │ ├── GetTransactionsByUserIdQuery.cs │ │ │ │ ├── InitializeTransactionCommand.cs │ │ │ │ ├── InitializeTransactionRequest.cs │ │ │ │ ├── InitiateSubscriptionTransactionCommand.cs │ │ │ │ ├── PaymentQueryBase.cs │ │ │ │ ├── PaymentRequestBase.cs │ │ │ │ ├── TransactionsWebhookCommand.cs │ │ │ │ ├── VerifyTransactionQuery.cs │ │ │ │ └── VerifyTransactionRequest.cs │ │ │ └── Responses │ │ │ │ ├── InitializeTransactionResponse.cs │ │ │ │ ├── InitiateSubscriptionTransactionResponse.cs │ │ │ │ ├── TransactionDto.cs │ │ │ │ ├── VerifyTransactionResponse.cs │ │ │ │ └── VerifyTransferResponse.cs │ │ │ ├── Handlers │ │ │ ├── Commands │ │ │ │ ├── InitializeTransactionCommandHandler.cs │ │ │ │ ├── InitiateSubscriptionTransactionHandler.cs │ │ │ │ ├── ProductsTransactionCommandHandler.cs │ │ │ │ └── SubscriptionsTransactionCommandHandler.cs │ │ │ └── Queries │ │ │ │ ├── GetTransactionByUserIdQueryHandler.cs │ │ │ │ ├── GetTransactionsByProductIdQueryHandler.cs │ │ │ │ └── VerifyTransactionQueryHandler.cs │ │ │ ├── Mappers │ │ │ └── TransactionMapperProfile.cs │ │ │ └── Services │ │ │ ├── IPaystackClient.cs │ │ │ └── PaystackClient.cs │ ├── Faq │ │ ├── Commands │ │ │ ├── CreateFaqCommand.cs │ │ │ ├── DeleteFaqCommand.cs │ │ │ └── UpdateFaqCommand.cs │ │ ├── Dtos │ │ │ ├── CreateFaqRequestDto.cs │ │ │ ├── CreateFaqResponseDto.cs │ │ │ ├── DeleteFaqResponseDto.cs │ │ │ ├── FaqResponseDto.cs │ │ │ ├── UpdateFaqRequestDto.cs │ │ │ └── UpdateFaqResponseDto.cs │ │ ├── Handlers │ │ │ ├── CreateFaqCommandHandler.cs │ │ │ ├── DeleteFaqCommandHandler.cs │ │ │ ├── GetAllFaqsQueryHandler.cs │ │ │ └── UpdateFaqCommandHandler.cs │ │ ├── Mappers │ │ │ └── FaqMappingProfile.cs │ │ └── Queries │ │ │ └── GetAllFaqsQuery.cs │ ├── HelpCenter │ │ ├── Command │ │ │ ├── CreateHelpCenterTopicCommand.cs │ │ │ ├── DeleteHelpCenterTopicCommand.cs │ │ │ └── UpdateHelpCenterTopicCommand.cs │ │ ├── Dtos │ │ │ ├── CreateHelpCenterTopicRequestDto.cs │ │ │ ├── HelpCenterResponseDto.cs │ │ │ ├── HelpCenterTopicResponseDto.cs │ │ │ ├── SearchHelpCenterTopicsRequestDto.cs │ │ │ └── UpdateHelpCenterTopicRequestDto.cs │ │ ├── Handler │ │ │ ├── CreateHelpCenterTopicCommandHandler.cs │ │ │ ├── DeleteHelpCenterTopicCommandHandler.cs │ │ │ ├── GetHelpCenterTopicByIdQueryHandler.cs │ │ │ ├── GetHelpCenterTopicsQueryHandler.cs │ │ │ ├── SearchHelpCenterTopicsQueryHandler.cs │ │ │ └── UpdateHelpCenterTopicCommandHandler.cs │ │ ├── Mappers │ │ │ └── HelpCenterTopicMappingProfile.cs │ │ └── Queries │ │ │ ├── GetHelpCenterTopicByIdQuery.cs │ │ │ ├── GetHelpCenterTopicsQuery.cs │ │ │ └── SearchHelpCenterTopicsQuery.cs │ ├── Jobs │ │ ├── Commands │ │ │ ├── CreateJobCommand.cs │ │ │ ├── DeleteJobByIdCommand.cs │ │ │ └── UpdateJobCommand.cs │ │ ├── Dtos │ │ │ ├── CreateJobDto.cs │ │ │ ├── GetJobRequestDto.cs │ │ │ ├── JobDto.cs │ │ │ ├── UpdateJobDto.cs │ │ │ └── UpdateJobResponseDto.cs │ │ ├── Handlers │ │ │ ├── CreateJobCommandHandler.cs │ │ │ ├── DeleteJobByIdCommandHandler.cs │ │ │ ├── GetJobByIdQueryHandler.cs │ │ │ ├── GetJobsQueryHandler.cs │ │ │ └── UpdateJobCommandHandler.cs │ │ ├── Mappers │ │ │ └── JobMapperProfile.cs │ │ └── Queries │ │ │ ├── GetJobByIdQuery.cs │ │ │ └── GetJobsQuery.cs │ ├── Languages │ │ ├── Commands │ │ │ ├── CreateLanguageCommand.cs │ │ │ ├── DeleteLanguageCommand.cs │ │ │ └── UpdateLanguageCommand.cs │ │ ├── Dtos │ │ │ ├── CreateLanguageRequestDto.cs │ │ │ ├── LanguageDto.cs │ │ │ ├── LanguageResponseDto.cs │ │ │ ├── LanguagesListResponseDto.cs │ │ │ └── UpdateLanguageRequestDto.cs │ │ ├── Handlers │ │ │ ├── Commands │ │ │ │ ├── CreateLanguageCommandHandler.cs │ │ │ │ ├── DeleteLanguageCommandHandler.cs │ │ │ │ └── UpdateLanguageCommandHandler.cs │ │ │ └── Queries │ │ │ │ ├── GetAllLanguagesQueryHandler.cs │ │ │ │ └── GetLanguageByIdQueryHandler.cs │ │ ├── Mappers │ │ │ └── LanguageMapperProfile.cs │ │ └── Queries │ │ │ ├── GetAllLanguagesQuery.cs │ │ │ └── GetLanguageByIdQuery.cs │ ├── LastLoginUser │ │ ├── Command │ │ │ └── LogoutCommand.cs │ │ ├── Dto │ │ │ ├── LastLoginDto.cs │ │ │ └── LastLoginResponseDto.cs │ │ ├── Handlers │ │ │ ├── GetLastLoginQueryHandler.cs │ │ │ └── LogoutCommandHandler.cs │ │ ├── Mapper │ │ │ └── LastloginMapper.cs │ │ └── Queries │ │ │ └── GetLastLoginQuery.cs │ ├── NewsLetterSubscription │ │ ├── Commands │ │ │ ├── AddSubscriberCommand.cs │ │ │ └── DeleteSubscriberCommand.cs │ │ ├── Dtos │ │ │ └── NewsLetterSubscriptionDto.cs │ │ ├── Handlers │ │ │ ├── AddSubscriberHandler.cs │ │ │ └── DeleteSubscriberHandlder.cs │ │ └── Mappers │ │ │ └── NewsLetterMapperProfile.cs │ ├── Notifications │ │ ├── Commands │ │ │ ├── CreateNotificationCommand.cs │ │ │ ├── CreateNotificationSettingsCommand.cs │ │ │ ├── DeleteAllNotificationsCommand.cs │ │ │ ├── DeleteNotificationByIdCommand.cs │ │ │ ├── MarkAllCommand.cs │ │ │ └── UpdateNotificationCommand.cs │ │ ├── Dtos │ │ │ ├── CreateNotificationDto.cs │ │ │ ├── CreateNotificationSettingsDto.cs │ │ │ ├── GetNotificationsResponseDto.cs │ │ │ ├── NotificationDto.cs │ │ │ ├── NotificationResult.cs │ │ │ ├── NotificationSettingsDto.cs │ │ │ └── UpdateNotificationDto.cs │ │ ├── Handlers │ │ │ ├── CreateNotificationCommandHandler.cs │ │ │ ├── CreateNotificationSettingsHandler.cs │ │ │ ├── DeleteAllNotificationsCommandHandler.cs │ │ │ ├── DeleteNotificationByIdCommandHandler.cs │ │ │ ├── GetAllNotificationsHandler.cs │ │ │ ├── GetNotificationSettingsHandler.cs │ │ │ ├── GetNotificationsHandler.cs │ │ │ ├── MarkAllCommandHandler.cs │ │ │ └── UpdateNotificationCommandHandler.cs │ │ ├── Mappers │ │ │ └── NotificationMapperProfile.cs │ │ └── Queries │ │ │ ├── GetAllNotificationsQuery.cs │ │ │ ├── GetNotificationSettingsQuery.cs │ │ │ └── GetNotificationsQuery.cs │ ├── OrganisationInvite │ │ ├── Commands │ │ │ ├── AcceptInviteCommand.cs │ │ │ └── CreateAndSendInvitesCommand.cs │ │ ├── Dtos │ │ │ ├── AcceptInviteDto.cs │ │ │ ├── CreateAndSendInvitesDto.cs │ │ │ ├── CreateAndSendInvitesResponseDto.cs │ │ │ ├── CreateUniqueOrganisationLinkDto.cs │ │ │ ├── GetUniqueOrganisationLinkDto.cs │ │ │ └── UpdateInviteDto.cs │ │ ├── Handlers │ │ │ ├── AcceptInviteCommandHandler.cs │ │ │ ├── CreateAndSendInvitesCommandHandler.cs │ │ │ └── GetUniqueOrganisationInviteLinkQueryHandler.cs │ │ ├── Queries │ │ │ └── GetUniqueOrganisationLinkQuery.cs │ │ └── Validators │ │ │ ├── IRequestValidator.cs │ │ │ ├── RequestValidator.cs │ │ │ └── ValidationErrors │ │ │ ├── ImplicitErrorOperator.cs │ │ │ ├── InviteAlreadyExistsError.cs │ │ │ ├── OrganisationDoesNotExistError.cs │ │ │ └── UserIsNotOwnerError.cs │ ├── Organisations │ │ ├── Commands │ │ │ ├── CreateOrganizationCommand.cs │ │ │ ├── DeleteUserOrganizationCommand.cs │ │ │ └── UpdateOrganizationCommand.cs │ │ ├── Dtos │ │ │ ├── CreateOrganisationResponseDto.cs │ │ │ ├── CreateOrganizationDto.cs │ │ │ ├── GetOrganisationResponseDto.cs │ │ │ ├── OrganizationDto.cs │ │ │ ├── OrganizationUserDto.cs │ │ │ ├── UpdateOrganizationDto.cs │ │ │ └── UpdateOrganizationResponseDto.cs │ │ ├── Handlers │ │ │ ├── CreateOrganisationCommandHandler.cs │ │ │ ├── DeleteUserOrganizationCommandHandler.cs │ │ │ ├── GetAllUsersQueryHandler.cs │ │ │ ├── GetOrganizationByIdQueryHandler.cs │ │ │ ├── GetUsersOrganizationsHandler.cs │ │ │ └── UpdateOrganizationCommandHandler.cs │ │ ├── Mappers │ │ │ └── OrganizationMapperProfile.cs │ │ └── Queries │ │ │ ├── GetAllUsersOrganizationsQuery.cs │ │ │ ├── GetAllUsersQuery.cs │ │ │ └── GetOrganizationByIdQuery.cs │ ├── Products │ │ ├── Commands │ │ │ ├── AddProductsCommand.cs │ │ │ ├── CreateProductCommand.cs │ │ │ ├── DeleteProductByIdCommand.cs │ │ │ └── UpdateProductCommand.cs │ │ ├── Dtos │ │ │ ├── CreateProductResponseDto.cs │ │ │ ├── GetProductsQueryParameters.cs │ │ │ ├── ProductCreationDto.cs │ │ │ ├── ProductDto.cs │ │ │ ├── ProductResponseDto.cs │ │ │ └── UpdateProductDto.cs │ │ ├── Handlers │ │ │ ├── AddProductsHandler .cs │ │ │ ├── CreateProductHandler.cs │ │ │ ├── DeleteProductByIdCommandHandler.cs │ │ │ ├── GetAllProductsHandler.cs │ │ │ ├── GetProductByIdQueryHandler.cs │ │ │ ├── GetProductByNameQueryHandler.cs │ │ │ ├── GetProductsQueryHandler.cs │ │ │ ├── GetUserProductsQueryHandler.cs │ │ │ └── UpdateProductCommandHandler.cs │ │ ├── Mappers │ │ │ └── ProductMapperProfile.cs │ │ ├── Queries │ │ │ ├── GetAllProductsQuery.cs │ │ │ ├── GetProductByIdQuery.cs │ │ │ ├── GetProductByNameQuery.cs │ │ │ ├── GetProductsQuery.cs │ │ │ └── GetUserProductsQuery.cs │ │ └── Validators │ │ │ └── UpdateProductDtoValidator.cs │ ├── Profiles │ │ ├── Dtos │ │ │ ├── DeleteProfilePictureDto.cs │ │ │ ├── ProfileDto.cs │ │ │ ├── UpdateProfile.cs │ │ │ └── UpdateProfilePictureDto.cs │ │ ├── Handlers │ │ │ ├── DeleteProfileHandler.cs │ │ │ ├── UpdateProfileHandler.cs │ │ │ └── UpdateProfilePictureHandler.cs │ │ └── Mappers │ │ │ └── ProfileMapperProfile.cs │ ├── Roles │ │ ├── Command │ │ │ ├── AssignRoleCommand.cs │ │ │ ├── CreateRoleCommand.cs │ │ │ ├── DeleteRoleCommand.cs │ │ │ └── UpdateRoleCommand.cs │ │ ├── Dto │ │ │ ├── AssignRoleDto.cs │ │ │ ├── CreateRoleRequestDto.cs │ │ │ ├── CreateRoleResponseDto.cs │ │ │ ├── DeleteRoleResponseDto.cs │ │ │ ├── PermissionUpdateModel.cs │ │ │ ├── RoleDetailsResponseDto.cs │ │ │ ├── RoleDto.cs │ │ │ ├── UpdateRoleRequestDto.cs │ │ │ └── UpdateRoleResponseDto.cs │ │ ├── Handler │ │ │ ├── AssignRoleCommandHandler.cs │ │ │ ├── CreateRoleCommandHandler.cs │ │ │ ├── DeleteRoleCommandHandler.cs │ │ │ ├── GetRoleByIdQueryHandler.cs │ │ │ ├── GetRolePermissionsQueryHandler.cs │ │ │ ├── GetRolesQueryHandler.cs │ │ │ └── UpdateRoleCommandHandler.cs │ │ ├── Mappers │ │ │ └── RoleMappingProfile.cs │ │ └── Queries │ │ │ ├── GetRoleByIdQuery.cs │ │ │ ├── GetRolePermissionsQuery.cs │ │ │ └── GetRolesQuery.cs │ ├── Squeeze │ │ ├── Commands │ │ │ └── CreateSqueezeCommand.cs │ │ ├── Dtos │ │ │ ├── CreateSqueezeRequestDto.cs │ │ │ ├── CreateSqueezeResponseDto.cs │ │ │ └── SqueezeDto.cs │ │ ├── Handlers │ │ │ └── CreateSqueezeCommandHandler.cs │ │ └── Mappers │ │ │ └── SqueezeMapperProfile.cs │ ├── Subscriptions │ │ ├── Commands │ │ │ └── ActivateSubscriptionCommand.cs │ │ ├── Dtos │ │ │ ├── Requests │ │ │ │ ├── GetSubscriptionByOrganizationIdQuery.cs │ │ │ │ ├── GetSubscriptionByUserIdQuery.cs │ │ │ │ ├── GetSubscriptionsQueryParameters.cs │ │ │ │ └── SubscribeFreePlan.cs │ │ │ └── Responses │ │ │ │ ├── SubscribeFreePlanResponse.cs │ │ │ │ └── SubscriptionDto.cs │ │ ├── Handlers │ │ │ ├── ActivateSubscriptionCommandHandler.cs │ │ │ ├── Commands │ │ │ │ └── CreateFreeSubscriptionPlanHandler.cs │ │ │ └── Queries │ │ │ │ ├── GetSubscriptionByOrganisationIdQueryHandler.cs │ │ │ │ ├── GetSubscriptionByUserIdQueryHandler.cs │ │ │ │ └── GetSubscriptionsQueryHandler.cs │ │ ├── Mappers │ │ │ └── SubscriptionMappingProfile.cs │ │ └── Queries │ │ │ └── GetSubscriptionsQuery.cs │ ├── SuperAdmin │ │ ├── Dto │ │ │ ├── UserDto.cs │ │ │ └── UsersQueryParameters.cs │ │ ├── Handlers │ │ │ └── GetUsersBySearchQueryHandler.cs │ │ ├── Mappers │ │ │ └── AdminUsersMappingProfile.cs │ │ └── Queries │ │ │ └── GetUsersBySearchQuery.cs │ ├── Timezones │ │ ├── Commands │ │ │ ├── CreateTimezoneCommand.cs │ │ │ └── UpdateTimezoneCommand.cs │ │ ├── Dtos │ │ │ ├── TimezoneDto.cs │ │ │ ├── TimezoneResponseDto.cs │ │ │ └── UpdateTimezoneDto.cs │ │ ├── Handlers │ │ │ ├── Commands │ │ │ │ ├── CreateTimezoneCommandHandler.cs │ │ │ │ └── UpdateTimezoneCommandHandler.cs │ │ │ └── Queries │ │ │ │ └── GetAllTimezonesQueryHandler.cs │ │ ├── Mappers │ │ │ └── TimezoneMapperProfile.cs │ │ └── Queries │ │ │ └── GetAllTimezonesQuery.cs │ ├── UserManagement │ │ ├── Commands │ │ │ ├── CreateUserLoginCommand.cs │ │ │ ├── FacebookLoginCommand.cs │ │ │ ├── GoogleLoginCommand.cs │ │ │ ├── SwitchOrganisationCommand.cs │ │ │ ├── UserRepository.cs │ │ │ └── UserSignUpCommand.cs │ │ ├── Dtos │ │ │ ├── ChangePasswordCommand.cs │ │ │ ├── FacebookLoginRequestDto.cs │ │ │ ├── ForgotPasswordDto.cs │ │ │ ├── GoogleLoginRequestDto.cs │ │ │ ├── OrganisationDto.cs │ │ │ ├── PasswordResetDto.cs │ │ │ ├── PasswordResetMobileDto.cs │ │ │ ├── SignUpResponse.cs │ │ │ ├── SwitchOrganisationRequestDto.cs │ │ │ ├── SwitchOrganisationResponseDto.cs │ │ │ ├── UserDto.cs │ │ │ ├── UserLoginRequestDto.cs │ │ │ ├── UserLoginResponseDto.cs │ │ │ ├── UserOrganzationDto.cs │ │ │ ├── UserResponseDto.cs │ │ │ ├── UserSignUpDto.cs │ │ │ └── VerifyForgotPasswordCodeDto.cs │ │ ├── Handlers │ │ │ ├── ChangePasswordHandler.cs │ │ │ ├── FacebookLoginCommandHandler.cs │ │ │ ├── ForgotPasswordHandler.cs │ │ │ ├── GetLoggedInUserDetailsQueryHandler.cs │ │ │ ├── GetUserByIdQueryHandler.cs │ │ │ ├── GetUsersQueryHandler.cs │ │ │ ├── GoogleLoginCommandHandler.cs │ │ │ ├── LoginUserCommandHandler.cs │ │ │ ├── PasswordResetHandler.cs │ │ │ ├── PasswordResetMobileHandler.cs │ │ │ ├── SwitchOrganisationCommandHandler.cs │ │ │ ├── UserSignUpCommandHandler.cs │ │ │ └── VerifyForgotPasswordCodeHandler.cs │ │ ├── Mappers │ │ │ └── UserMappingProfile.cs │ │ └── Queries │ │ │ ├── GetLoggedInUserDetailsQuery.cs │ │ │ ├── GetUserByIdQuery.cs │ │ │ └── GetUsersQuery.cs │ └── WaitLists │ │ ├── Commands │ │ ├── CreateWaitlistCommand.cs │ │ └── DeleteWaitlistByIdCommand.cs │ │ ├── Dtos │ │ └── WaitListDto.cs │ │ ├── Handlers │ │ ├── CreateWaitlistCommandHandler.cs │ │ ├── DeleteWaitlistByIdCommandHandler.cs │ │ └── GetAllWaitlistQueryHandler.cs │ │ ├── Mappers │ │ └── WaitListMappingProfile.cs │ │ └── Queries │ │ └── GetAllWaitlistQuery.cs ├── Hng.Application.csproj ├── Shared │ └── Dtos │ │ ├── BaseQueryParameters.cs │ │ ├── BaseResponseDto.cs │ │ ├── ControllerErrorResponse.cs │ │ ├── ControllerResponse.cs │ │ ├── EmptyDataResponse.cs │ │ ├── FailureResponseDto.cs │ │ ├── PagedListDto.cs │ │ ├── PagedListMetadataDto.cs │ │ ├── PaginatedResponseDto.cs │ │ ├── StatusCodeResponse.cs │ │ ├── SuccessResponseDto.cs │ │ └── Validators │ │ ├── EmailCollectionAttribute.cs │ │ └── ValidGuidAttribute.cs └── Utils │ ├── CloudinarySettings.cs │ ├── GenerateTransactionReference.cs │ └── LowerCaseNamingPolicy.cs ├── Hng.Domain ├── Entities │ ├── ApiStatus.cs │ ├── BillingPlan.cs │ ├── Blog.cs │ ├── Category.cs │ ├── Comment.cs │ ├── ContactUs.cs │ ├── EmailTemplate.cs │ ├── EntityBase.cs │ ├── Faq.cs │ ├── HelpCenterTopic.cs │ ├── Job.cs │ ├── Language.cs │ ├── LastLogin.cs │ ├── Message.cs │ ├── NewsLetterSubscriber.cs │ ├── Notification.cs │ ├── NotificationSettings.cs │ ├── Organization.cs │ ├── OrganizationInvite.cs │ ├── Product.cs │ ├── Profile.cs │ ├── Role.cs │ ├── RolePermission.cs │ ├── Squeeze.cs │ ├── Subscription.cs │ ├── Timezone.cs │ ├── Transaction.cs │ ├── User.cs │ ├── UserRole.cs │ └── Waitlist.cs ├── EntitiesConfigurations │ ├── ApiStatusConfiguration.cs │ ├── NewsLetterSubscriberConfig.cs │ ├── PaymentConfiguration.cs │ ├── RoleConfig.cs │ ├── RolePermissionConfig.cs │ ├── SubscriptionConfiguration.cs │ └── UserRoleConfig.cs ├── Enums │ ├── ApiStatusType.cs │ ├── BlogCategory.cs │ ├── ExperienceLevel.cs │ ├── MessageStatus.cs │ ├── MessageType.cs │ ├── OrganizationInviteStatus.cs │ ├── PaystackResponseStatus.cs │ ├── SubscriptionFrequency.cs │ ├── SubscriptionPlan.cs │ ├── TransactionIntegrationPartners.cs │ ├── TransactionStatus.cs │ └── TransactionType.cs └── Hng.Domain.csproj ├── Hng.Graphql ├── ConfigureGraphql.cs ├── Features │ ├── Mutations │ │ ├── Mutations.Authentication.cs │ │ ├── Mutations.BillingPlans.cs │ │ ├── Mutations.Blog.cs │ │ ├── Mutations.Categories.cs │ │ ├── Mutations.Comment.cs │ │ ├── Mutations.ContactUs.cs │ │ ├── Mutations.EmailTemplate.cs │ │ ├── Mutations.Faq.cs │ │ ├── Mutations.HelpCenterTopics.cs │ │ ├── Mutations.NewsLetter.cs │ │ ├── Mutations.Notification.cs │ │ ├── Mutations.NotificationSettings.cs │ │ └── Mutations.Subscriptions.cs │ └── Queries │ │ ├── Queries.Admin.cs │ │ ├── Queries.Authentication.cs │ │ ├── Queries.BillingPlans.cs │ │ ├── Queries.Blog.cs │ │ ├── Queries.Categories.cs │ │ ├── Queries.Comment.cs │ │ ├── Queries.ContactUs.cs │ │ ├── Queries.Dashboard.cs │ │ ├── Queries.EmailTemplate.cs │ │ ├── Queries.Faq.cs │ │ ├── Queries.HelpCenterTopics.cs │ │ ├── Queries.Notification.cs │ │ ├── Queries.NotificationSetting.cs │ │ └── Queries.Subscriptions.cs ├── Hng.Graphql.csproj ├── Mutations.cs └── Queries.cs ├── Hng.Infrastructure ├── ConfigureInfrastructure.cs ├── Context │ └── ApplicationDbContext.cs ├── EmailTemplates │ ├── OrganisationInviteEmail.html │ ├── TemplateDir.cs │ ├── forgot-password-mobile.html │ └── forgot-password.html ├── Hng.Infrastructure.csproj ├── Migrations │ ├── 20240807200239_NewMigration.Designer.cs │ ├── 20240807200239_NewMigration.cs │ ├── 20240808092602_new_fields_to_blog.Designer.cs │ ├── 20240808092602_new_fields_to_blog.cs │ ├── 20240808175516_TimezoneTable.Designer.cs │ ├── 20240808175516_TimezoneTable.cs │ ├── 20240808184539_HelpCenterTopic.Designer.cs │ ├── 20240808184539_HelpCenterTopic.cs │ ├── 20240810172648_add to product.Designer.cs │ ├── 20240810172648_add to product.cs │ ├── 20240811002137_OrganisationInvites.Designer.cs │ ├── 20240811002137_OrganisationInvites.cs │ ├── 20240811002215_AddSuperAdminColumn.Designer.cs │ ├── 20240811002215_AddSuperAdminColumn.cs │ ├── 20240812055818_faqCategories.Designer.cs │ ├── 20240812055818_faqCategories.cs │ ├── 20240812152054_OrganisationInvitesGuidInviteLink.Designer.cs │ ├── 20240812152054_OrganisationInvitesGuidInviteLink.cs │ ├── 20240813015229_BillingPlansTable.Designer.cs │ ├── 20240813015229_BillingPlansTable.cs │ ├── 20240813074400_is_active_field_to_org.Designer.cs │ ├── 20240813074400_is_active_field_to_org.cs │ ├── 20240813081318_update.Designer.cs │ ├── 20240813081318_update.cs │ ├── 20240814103112_OrganisationInvitesWithInviteLinkStrings.Designer.cs │ ├── 20240814103112_OrganisationInvitesWithInviteLinkStrings.cs │ ├── 20240814190933_faqUpdatedClass.Designer.cs │ ├── 20240814190933_faqUpdatedClass.cs │ ├── 20240814204322_ManyToManyPermissions.Designer.cs │ ├── 20240814204322_ManyToManyPermissions.cs │ ├── 20240815084034_UpdatedProfileTablewithDepartmentProperty.Designer.cs │ ├── 20240815084034_UpdatedProfileTablewithDepartmentProperty.cs │ ├── 20240815205004_UpdatedUserTableWithTwoProperties.Designer.cs │ ├── 20240815205004_UpdatedUserTableWithTwoProperties.cs │ ├── 20240815205251_LastLogin.Designer.cs │ ├── 20240815205251_LastLogin.cs │ ├── 20240815210332_UpdatedProfileTableInstagram.Designer.cs │ ├── 20240815210332_UpdatedProfileTableInstagram.cs │ ├── 20240815235944_CategoryTable.Designer.cs │ ├── 20240815235944_CategoryTable.cs │ ├── 20240816035339_IPAddressLastLogin.Designer.cs │ ├── 20240816035339_IPAddressLastLogin.cs │ ├── 20240816154735_UniqueOrganizationLink.Designer.cs │ ├── 20240816154735_UniqueOrganizationLink.cs │ ├── 20240817112410_OrganisationInviteGuidCode.Designer.cs │ ├── 20240817112410_OrganisationInviteGuidCode.cs │ ├── 20240823114543_ApiStatusTable.Designer.cs │ ├── 20240823114543_ApiStatusTable.cs │ ├── 20240823154842_LanguageEntities.Designer.cs │ ├── 20240823154842_LanguageEntities.cs │ ├── 20240829072245_ContactUs.Designer.cs │ ├── 20240829072245_ContactUs.cs │ ├── 20240831001639_Waitlist.Designer.cs │ ├── 20240831001639_Waitlist.cs │ ├── 20240831093552_added squeeze entity.Designer.cs │ ├── 20240831093552_added squeeze entity.cs │ ├── 20250227230159_AddIsDeletedToNewsLetterSubscriber.Designer.cs │ ├── 20250227230159_AddIsDeletedToNewsLetterSubscriber.cs │ └── ApplicationDbContextModelSnapshot.cs ├── Repository │ ├── Interface │ │ └── IRepository.cs │ └── Repository.cs ├── Services │ ├── AuthenticationService.cs │ ├── EmailService.cs │ ├── EmailTemplateService.cs │ ├── FacebookAuthService.cs │ ├── GoogleAuthService.cs │ ├── Interfaces │ │ ├── IAuthenticationService.cs │ │ ├── IEmailService.cs │ │ ├── IEmailTemplateService.cs │ │ ├── IFacebookAuthService.cs │ │ ├── IGoogleAuthService.cs │ │ ├── IMessageQueueService.cs │ │ ├── IOrganisationInviteService.cs │ │ ├── IPasswordService.cs │ │ ├── ISmsService.cs │ │ └── ITokenService.cs │ ├── MessageQueueHandlerService.cs │ ├── MessageQueueService.cs │ ├── OrganisationInviteService.cs │ ├── PasswordService.cs │ ├── SeederService.cs │ └── TokenService.cs └── Utilities │ ├── EmailQueue │ ├── Email.cs │ └── MessageToEmailExtension.cs │ ├── FrontendUrl.cs │ ├── Jwt.cs │ ├── Results │ ├── Error.cs │ └── Result.cs │ ├── SmtpCredentials.cs │ └── StringKeys │ ├── EmailConstants.cs │ ├── PaystackApiKeys.cs │ └── PaystackEventKeys.cs └── Hng.Web ├── .dockerignore ├── Controllers ├── AdminController.cs ├── ApiStatusController.cs ├── AuthenticationController.cs ├── BillingPlansController.cs ├── BlogController.cs ├── CategoriesController.cs ├── CommentController.cs ├── ContactUsController.cs ├── DashboardsController.cs ├── EmailTemplateController.cs ├── FaqController.cs ├── HelpCenterTopicController.cs ├── JobController.cs ├── LanguagesController.cs ├── LastLoginController.cs ├── LogsController.cs ├── NewsLetterController.cs ├── NotificationController.cs ├── NotificationSettingsController.cs ├── OrganizationController.cs ├── ProductController.cs ├── ProfileController.cs ├── SubscriptionsController.cs ├── TimezonesController.cs ├── TransactionsController.cs ├── UserController.cs └── WaitlistController.cs ├── Extensions ├── Documentation.cs ├── LoggerExtensions.cs └── MigrateAndSeedExtension.cs ├── Filters └── Swashbuckle │ └── SnakeCaseDictionaryFilter.cs ├── Hng.Web.csproj ├── Hng.Web.http ├── ModelStateError ├── ModelError.cs └── ModelStateErrorResponse.cs ├── Program.cs ├── Properties └── launchSettings.json ├── appsettings.json └── nlog.config /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "nuget" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/Hng.Csharp.Web.sln", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /TestConsole/Program.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Commands; 2 | using Hng.Application.Features.UserManagement.Dtos; 3 | 4 | namespace Hng.Application.Features.UserManagement.Commands 5 | { 6 | public class CreateUserLoginCommand : IRequest> 7 | { 8 | public CreateUserLoginCommand(UserLoginRequestDto loginRequest) 9 | { 10 | LoginRequestBody = loginRequest; 11 | } 12 | public UserLoginRequestDto LoginRequestBody { get; } 13 | } 14 | } -------------------------------------------------------------------------------- /TestConsole/TestConsole.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes 1; 2 | 3 | events { worker_connections 1024; } 4 | 5 | http { 6 | upstream backend { 7 | least_conn; 8 | server backend:5000; 9 | } 10 | 11 | server { 12 | listen 80; 13 | 14 | server_name _; 15 | 16 | location / { 17 | proxy_pass http://backend; 18 | proxy_http_version 1.1; 19 | proxy_set_header Upgrade $http_upgrade; 20 | proxy_set_header Connection keep-alive; 21 | proxy_set_header Host $host; 22 | proxy_cache_bypass $http_upgrade; 23 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 24 | proxy_set_header X-Forwarded-Proto $scheme; 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /scripts/dev-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # navigate to repo root and fetch latest changes 5 | cd "$(git rev-parse --show-toplevel)" 6 | 7 | git checkout dev 8 | git pull origin dev 9 | 10 | # install dependencies 11 | dotnet restore ./Hng.Csharp.Web.sln 12 | 13 | # build app 14 | dotnet build --no-restore -c Debug 15 | 16 | # publish app 17 | dotnet publish ./src/Hng.Web/Hng.Web.csproj --no-build -c Debug 18 | 19 | # restart the systemd service 20 | sudo systemctl restart hng-web-dev -------------------------------------------------------------------------------- /scripts/prod-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # navigate to repo root and fetch lates change 5 | cd $(git rev-parse --show-toplevel) 6 | 7 | git checkout main 8 | git pull origin main 9 | 10 | # install dependencies 11 | dotnet restore Hng.Csharp.Web.sln 12 | 13 | # build app 14 | dotnet build -c Release 15 | 16 | # publish app 17 | dotnet publish -c Release 18 | 19 | # restart the systemd service 20 | sudo systemctl restart hng-web 21 | -------------------------------------------------------------------------------- /scripts/staging-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # navigate to repo root and fetch lates change 5 | cd $(git rev-parse --show-toplevel) 6 | 7 | git checkout staging 8 | git pull origin staging 9 | 10 | # install dependencies 11 | dotnet restore Hng.Csharp.Web.sln 12 | 13 | # build app 14 | dotnet build -c Release 15 | 16 | # publish app 17 | dotnet publish -c Release 18 | 19 | # restart the systemd service 20 | sudo systemctl restart hng-web-staging 21 | -------------------------------------------------------------------------------- /src/Hng.Application.Test/Features/HelpCenter/HelpCenterTopicsTestsSetup.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Hng.Domain.Entities; 3 | using Hng.Infrastructure.Repository.Interface; 4 | using MediatR; 5 | using Moq; 6 | 7 | namespace Hng.Application.Test.Features.HelpCenter 8 | { 9 | public class HelpCenterTopicsTestsSetup 10 | { 11 | protected readonly Mock> _repositoryMock; 12 | protected readonly Mock _mapperMock; 13 | protected readonly Mock _mediatorMock; 14 | 15 | public HelpCenterTopicsTestsSetup() 16 | { 17 | _repositoryMock = new Mock>(); 18 | _mapperMock = new Mock(); 19 | _mediatorMock = new Mock(); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/Hng.Application.Test/Features/Languages/CreateLanguageCommandShould.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Application.Test.Features.Languages 8 | { 9 | internal class CreateLanguageCommandShould 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application.Test/TestSetupShould.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Hng.Application.Test; 4 | 5 | public class TestSetupShould 6 | { 7 | [Fact] 8 | public void Pass_For_Setup_Sake() 9 | { 10 | Assert.False(1 * 1 == 2, "1 times 1 should not be equal to 2"); 11 | } 12 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ApiStatuses/Commands/CreateApiStatusCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ApiStatuses.Dtos.Requests; 2 | using MediatR; 3 | using Microsoft.AspNetCore.Http; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | namespace Hng.Application.Features.ApiStatuses.Commands 7 | { 8 | public class CreateApiStatusCommand : IRequest 9 | { 10 | [Required] 11 | public IFormFile File { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ApiStatuses/Dtos/Requests/ApiStatusWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Features.ApiStatuses.Dtos.Requests 2 | { 3 | public class ApiStatusWrapper 4 | { 5 | public Dictionary> Collection { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ApiStatuses/Dtos/Requests/GetAllApiStatusesQueries.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ApiStatuses.Dtos.Responses; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.ApiStatuses.Dtos.Requests 6 | { 7 | public class GetAllApiStatusesQueries : IRequest>> 8 | { 9 | public int PageNumber { get; set; } 10 | public int PageSize { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ApiStatuses/Dtos/Responses/ApiStatusResponseDto.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ApiStatuses.Dtos.Requests; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.ApiStatuses.Dtos.Responses 5 | { 6 | public record ApiStatusResponseDto : ApiStatusModel 7 | { 8 | [JsonPropertyName("last_checked")] 9 | public DateTime LastChecked { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Commands/CreateBillingPlanCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.BillingPlans.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.BillingPlans.Commands 6 | { 7 | public class CreateBillingPlanCommand : IRequest> 8 | { 9 | public CreateBillingPlanDto BillingPlanDto { get; } 10 | public CreateBillingPlanCommand(CreateBillingPlanDto billingPlanDto) 11 | { 12 | BillingPlanDto = billingPlanDto; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Commands/DeleteBillingPlanCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.BillingPlans.Commands 5 | { 6 | public class DeleteBillingPlanCommand : IRequest> 7 | { 8 | public Guid Id { get; } 9 | 10 | public DeleteBillingPlanCommand(Guid id) 11 | { 12 | Id = id; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Commands/UpdateBillingPlanCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.BillingPlans.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.BillingPlans.Commands 6 | { 7 | public class UpdateBillingPlanCommand : IRequest> 8 | { 9 | public Guid Id { get; } 10 | public CreateBillingPlanDto BillingPlanDto { get; } 11 | 12 | public UpdateBillingPlanCommand(Guid id, CreateBillingPlanDto billingPlanDto) 13 | { 14 | Id = id; 15 | BillingPlanDto = billingPlanDto; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Dtos/CreateBillingPlanDto.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Enums; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.BillingPlans.Dtos 5 | { 6 | public class CreateBillingPlanDto 7 | { 8 | [JsonPropertyName("name")] 9 | public string Name { get; set; } 10 | 11 | [JsonPropertyName("frequency")] 12 | public SubscriptionFrequency Frequency { get; set; } 13 | 14 | [JsonPropertyName("is_active")] 15 | public bool IsActive { get; set; } 16 | 17 | [JsonPropertyName("amount")] 18 | public decimal Amount { get; set; } 19 | 20 | [JsonPropertyName("description")] 21 | public string Description { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Mappers/BillingPlanMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.BillingPlans.Dtos; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.BillingPlans.Mappers 5 | { 6 | public class BillingPlanMapperProfile : AutoMapper.Profile 7 | { 8 | public BillingPlanMapperProfile() 9 | { 10 | CreateMap().ReverseMap(); 11 | CreateMap(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Queries/GetAllBillingPlansQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.BillingPlans.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.BillingPlans.Queries 6 | { 7 | public class GetAllBillingPlansQuery : IRequest>> 8 | { 9 | public BaseQueryParameters QueryParameters { get; } 10 | 11 | public GetAllBillingPlansQuery(BaseQueryParameters queryParameters) 12 | { 13 | QueryParameters = queryParameters; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/BillingPlans/Queries/GetBillingPlanByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.BillingPlans.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.BillingPlans.Queries 6 | { 7 | public class GetBillingPlanByIdQuery : IRequest> 8 | { 9 | public Guid Id { get; } 10 | public GetBillingPlanByIdQuery(Guid id) 11 | { 12 | Id = id; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Commands/CreateBlogCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Blogs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Blogs.Commands; 5 | 6 | public class CreateBlogCommand(CreateBlogDto blogBody) : IRequest 7 | { 8 | public CreateBlogDto BlogBody { get; } = blogBody; 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Commands/DeleteBlogByIdCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | 3 | namespace Hng.Application.Features.Blogs.Commands; 4 | 5 | public class DeleteBlogByIdCommand(Guid blogId) : IRequest 6 | { 7 | public Guid BlogId { get; } = blogId; 8 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Commands/UpdateBlogCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Blogs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Blogs.Commands; 5 | 6 | public class UpdateBlogCommand(UpdateBlogDto blog, Guid id) : IRequest 7 | { 8 | public Guid BlogId { get; } = id; 9 | public UpdateBlogDto Blog { get; } = blog; 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Dtos/CreateBlogDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Hng.Domain.Enums; 3 | 4 | namespace Hng.Application.Features.Blogs.Dtos; 5 | 6 | public class CreateBlogDto 7 | { 8 | [JsonPropertyName("title")] 9 | public string Title { get; set; } 10 | [JsonPropertyName("content")] 11 | public string Content { get; set; } 12 | [JsonConverter(typeof(JsonStringEnumConverter))] 13 | [JsonPropertyName("category")] 14 | public BlogCategory Category { get; set; } 15 | 16 | [JsonPropertyName("image_url")] 17 | public string ImageUrl { get; set; } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Dtos/CreateBlogResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Blogs.Dtos; 4 | 5 | public class CreateBlogResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; init; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; init; } 12 | 13 | [JsonPropertyName("data")] 14 | public BlogDto Data { get; init; } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Dtos/GetBlogResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Blogs.Dtos; 4 | 5 | public class GetBlogResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public BlogDto Data { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Dtos/UpdateBlogDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Hng.Domain.Enums; 3 | 4 | namespace Hng.Application.Features.Blogs.Dtos; 5 | 6 | public class UpdateBlogDto 7 | { 8 | [JsonPropertyName("title")] 9 | public string Title { get; set; } 10 | [JsonPropertyName("content")] 11 | public string Content { get; set; } 12 | [JsonConverter(typeof(JsonStringEnumConverter))] 13 | [JsonPropertyName("category")] 14 | public BlogCategory Category { get; set; } 15 | 16 | [JsonPropertyName("image_url")] 17 | public string ImageUrl { get; set; } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Dtos/UpdateBlogResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Blogs.Dtos; 4 | 5 | public class UpdateBlogResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public BlogDto Data { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Mappers/BlogMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Blogs.Dtos; 2 | using Hng.Domain.Entities; 3 | using Profile = AutoMapper.Profile; 4 | 5 | namespace Hng.Application.Features.Blogs.Mappers; 6 | 7 | public class BlogMapperProfile : Profile 8 | { 9 | public BlogMapperProfile() 10 | { 11 | CreateMap(); 12 | CreateMap() 13 | .ReverseMap(); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Queries/GetBlogByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Blogs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Blogs.Queries; 5 | 6 | public class GetBlogByIdQuery(Guid id) : IRequest 7 | { 8 | public Guid BlogId { get; } = id; 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Blogs/Queries/GetBlogsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Blogs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Blogs.Queries; 5 | 6 | public class GetBlogsQuery : IRequest>; 7 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Commands/CreateCategoryCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Categories.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Categories.Commands 6 | { 7 | public class CreateCategoryCommand : IRequest> 8 | { 9 | public string Name { get; set; } 10 | public string Description { get; set; } 11 | public string Slug { get; set; } 12 | 13 | public CreateCategoryCommand(string name, string description, string slug) 14 | { 15 | Name = name; 16 | Description = description; 17 | Slug = slug; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Commands/DeleteCategoryCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Categories.Commands 5 | { 6 | public record DeleteCategoryCommand(Guid Id) : IRequest> 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Dtos/CategoryDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Categories.Dtos 4 | { 5 | public class CategoryDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | 10 | [JsonPropertyName("name")] 11 | public string Name { get; set; } 12 | 13 | [JsonPropertyName("description")] 14 | public string Description { get; set; } 15 | 16 | [JsonPropertyName("slug")] 17 | public string Slug { get; set; } 18 | 19 | [JsonPropertyName("created_at")] 20 | public DateTime CreatedAt { get; set; } 21 | 22 | [JsonPropertyName("updated_at")] 23 | public DateTime? UpdatedAt { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Dtos/CategoryListDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Categories.Dtos 4 | { 5 | public class CategoryListDto 6 | { 7 | [JsonPropertyName("categories")] 8 | public List Categories { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Dtos/CreateCategoryDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Categories.Dtos 4 | { 5 | public class CreateCategoryDto 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonPropertyName("description")] 11 | public string Description { get; set; } 12 | 13 | [JsonPropertyName("slug")] 14 | public string Slug { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Dtos/GetAllCategoriesQueryParams.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | 3 | namespace Hng.Application.Features.Categories.Dtos 4 | { 5 | public class GetAllCategoriesQueryParams : BaseQueryParameters 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Mappers/CategoryMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Categories.Dtos; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.Categories.Mappers 5 | { 6 | public class CategoryMapperProfile : AutoMapper.Profile 7 | { 8 | public CategoryMapperProfile() 9 | { 10 | CreateMap(); 11 | CreateMap(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Queries/GetAllCategoriesQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Categories.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Categories.Queries 6 | { 7 | public record GetAllCategoriesQuery(GetAllCategoriesQueryParams QueryParams) : IRequest>> 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Queries/GetCategoriesQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Categories.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Categories.Queries 5 | { 6 | public class GetCategoriesQuery : IRequest> 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Categories/Queries/GetCategoryByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Categories.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Categories.Queries 6 | { 7 | public record GetCategoryByIdQuery(Guid Id) : IRequest> 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Comments/Commands/CreateCommentCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Comments.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Comments.Commands; 5 | 6 | public class CreateCommentCommand(CreateCommentDto createCommentDto, Guid blogId) : IRequest 7 | { 8 | public Guid BlogId { get; } = blogId; 9 | public CreateCommentDto CommentBody { get; } = createCommentDto; 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Comments/Dtos/CommentDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Comments.Dtos; 4 | 5 | public class CommentDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | [JsonPropertyName("content")] 10 | public string Content { get; set; } 11 | [JsonPropertyName("created_at")] 12 | public DateTime CreatedAt { get; set; } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Comments/Dtos/CreateCommentDto.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Features.Comments.Dtos; 2 | 3 | public class CreateCommentDto 4 | { 5 | public string Content { get; set; } 6 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Comments/Mappers/CommentMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Comments.Dtos; 2 | using Hng.Domain.Entities; 3 | using Profile = AutoMapper.Profile; 4 | 5 | namespace Hng.Application.Features.Comments.Mappers; 6 | 7 | public class CommentMapperProfile : Profile 8 | { 9 | public CommentMapperProfile() 10 | { 11 | CreateMap(); 12 | CreateMap() 13 | .ReverseMap(); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Comments/Queries/GetCommentsByBlogIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Comments.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Comments.Queries; 5 | 6 | public class GetCommentsByBlogIdQuery(Guid blogId) : IRequest> 7 | { 8 | public Guid BlogId { get; set; } = blogId; 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Command/CreateContactUsCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ContactsUs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.ContactsUs.Command 5 | { 6 | public class CreateContactUsCommand : IRequest> 7 | { 8 | public CreateContactUsCommand(ContactUsRequestDto contactUsRequest) 9 | { 10 | ContactUsRequest = contactUsRequest; 11 | } 12 | 13 | public ContactUsRequestDto ContactUsRequest { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Command/DeleteContactUsCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ContactsUs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.ContactsUs.Command 5 | { 6 | public class DeleteContactUsCommand : IRequest> 7 | { 8 | public DeleteContactUsCommand(Guid id) 9 | { 10 | Id = id; 11 | } 12 | public Guid Id { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Dtos/ContactResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.ContactsUs.Dtos 9 | { 10 | public class ContactResponse 11 | { 12 | [JsonPropertyName("status_code")] 13 | public int StatusCode { get; set; } 14 | [JsonPropertyName("message")] 15 | public string Message { get; set; } 16 | [JsonPropertyName("data")] 17 | public T Data { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Dtos/ContactUsRequestDto.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.ContactsUs.Dtos 9 | { 10 | public class ContactUsRequestDto 11 | { 12 | [JsonProperty("fullname")] 13 | public string FullName { get; set; } 14 | 15 | [JsonProperty("email")] 16 | public string Email { get; set; } 17 | 18 | [JsonProperty("phonenumber")] 19 | public string PhoneNumber { get; set; } 20 | 21 | [JsonProperty("message")] 22 | public string Message { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Dtos/ContactUsResponseDto.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.ContactsUs.Dtos 9 | { 10 | public class ContactUsResponseDto 11 | { 12 | [JsonProperty("id")] 13 | public Guid Id { get; set; } 14 | 15 | [JsonProperty("fullname")] 16 | public string FullName { get; set; } 17 | 18 | [JsonProperty("email")] 19 | public string Email { get; set; } 20 | 21 | [JsonProperty("phonenumber")] 22 | public string PhoneNumber { get; set; } 23 | 24 | [JsonProperty("message")] 25 | public string Message { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Mappers/ContactUsMappingProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ContactsUs.Dtos; 2 | using Hng.Domain.Entities; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.ContactsUs.Mappers 10 | { 11 | public class ContactUsMappingProfile : AutoMapper.Profile 12 | { 13 | public ContactUsMappingProfile() 14 | { 15 | CreateMap().ReverseMap(); 16 | CreateMap() 17 | .ForMember(dest => dest.FullName, opt => opt.MapFrom(src => src.FullName)) 18 | .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.Email)) 19 | .ReverseMap(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ContactsUs/Queries/GetAllContactUsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ContactsUs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.ContactsUs.Queries 5 | { 6 | public class GetAllContactUsQuery : IRequest>> 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Dtos/NavigationDataDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Application.Features.Dashboard.Dtos 8 | { 9 | public class NavigationDataDto 10 | { 11 | public List Overview { get; set; } 12 | } 13 | 14 | public class ReportDataDto 15 | { 16 | public int Month { get; set; } 17 | public decimal Revenue { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Dtos/SalesTrendQueryParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Dashboard.Dtos 9 | { 10 | public class SalesTrendQueryParameter 11 | { 12 | [JsonPropertyName("start_date")] 13 | public DateTime StartDate { get; set; } 14 | [JsonPropertyName("end_date")] 15 | public DateTime EndDate { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Mappers/DashboardMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.Dashboard.Mappers 5 | { 6 | public class DashboardMapperProfile : AutoMapper.Profile 7 | { 8 | public DashboardMapperProfile() 9 | { 10 | CreateMap().ReverseMap(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Queries/GetDashboardQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Dashboard.Dtos; 2 | using Hng.Application.Features.Products.Dtos; 3 | using MediatR; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Hng.Application.Features.Dashboard.Queries 11 | { 12 | public class GetDashboardQuery : IRequest 13 | { 14 | public Guid UserId { get; set; } 15 | 16 | public GetDashboardQuery(Guid userId) 17 | { 18 | UserId = userId; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Queries/GetExportDataQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Dashboard.Dtos; 2 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Dashboard.Queries 6 | { 7 | public class GetExportDataQuery : IRequest> 8 | { 9 | public GetExportDataQuery(SalesTrendQueryParameter parameters) 10 | { 11 | productsQueryParameters = parameters; 12 | } 13 | 14 | public SalesTrendQueryParameter productsQueryParameters { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Queries/GetNavigationDataQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Dashboard.Dtos; 2 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 3 | using Hng.Application.Features.Products.Dtos; 4 | using Hng.Application.Shared.Dtos; 5 | using MediatR; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Hng.Application.Features.Dashboard.Queries 13 | { 14 | public class GetNavigationDataQuery : IRequest 15 | { 16 | public GetNavigationDataQuery() 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Dashboard/Queries/GetSalesTrendQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Dashboard.Dtos; 2 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 3 | using Hng.Application.Features.Products.Dtos; 4 | using Hng.Application.Shared.Dtos; 5 | using MediatR; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Hng.Application.Features.Dashboard.Queries 13 | { 14 | public class GetSalesTrendQuery : IRequest> 15 | { 16 | public GetSalesTrendQuery(SalesTrendQueryParameter parameters) 17 | { 18 | productsQueryParameters = parameters; 19 | } 20 | 21 | public SalesTrendQueryParameter productsQueryParameters { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/EmailTemplates/Commands/CreateEmailTemplateCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.EmailTemplates.DTOs; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.EmailTemplates.Commands; 5 | 6 | public record CreateEmailTemplateCommand(CreateEmailTemplateDTO TemplateDTO) : IRequest; 7 | 8 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/EmailTemplates/DTOs/CreateEmailTemplateDTO.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.EmailTemplates.DTOs; 5 | 6 | public record CreateEmailTemplateDTO 7 | { 8 | [Required] 9 | [JsonPropertyName("name")] 10 | public string Name { get; set; } 11 | 12 | [Required] 13 | [JsonPropertyName("subject")] 14 | public string Subject { get; set; } 15 | 16 | [Required] 17 | [JsonPropertyName("template_body")] 18 | public string TemplateBody { get; set; } 19 | 20 | [JsonPropertyName("placeholders")] 21 | public Dictionary Placeholders { get; set; } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/EmailTemplates/DTOs/EmailTemplateDTO.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.EmailTemplates.DTOs; 4 | 5 | public record EmailTemplateDTO 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | 10 | [JsonPropertyName("name")] 11 | public string Name { get; set; } 12 | 13 | [JsonPropertyName("subject")] 14 | public string Subject { get; set; } 15 | 16 | [JsonPropertyName("template_body")] 17 | public string TemplateBody { get; set; } 18 | 19 | [JsonPropertyName("placeholders")] 20 | public Dictionary Placeholders { get; set; } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/EmailTemplates/Mappers/EmailTemplateMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.EmailTemplates.DTOs; 5 | 6 | public class EmailTemplateMapperProfile : AutoMapper.Profile 7 | { 8 | public EmailTemplateMapperProfile() 9 | { 10 | CreateMap().ReverseMap(); 11 | 12 | CreateMap().ReverseMap(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/EmailTemplates/Queries/GetAllEmailTemplatesQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.EmailTemplates.DTOs; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.EmailTemplates.Queries; 6 | 7 | public record GetAllEmailTemplatesQuery(int PageNumber = 1, int PageSize = 5) : IRequest>>; 8 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/FilesUploadIntegrations/Cloudinary/Services/IImageService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | 3 | namespace Hng.Application.Features.ExternalIntegrations.FilesUploadIntegrations.Cloudinary.Services 4 | { 5 | public interface IImageService 6 | { 7 | Task DeleteImageAsync(string url); 8 | Task UploadImageAsync(IFormFile file); 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/ErrorResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 2 | { 3 | public class ErrorResponse 4 | { 5 | public bool Status { get; set; } 6 | public string Error { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/GetTransactionsByProductIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.PaymentIntegrations.Paystack.Dtos.Requests 6 | { 7 | public class GetTransactionsByProductIdQuery : IRequest> 8 | { 9 | public Guid ProductId { get; } 10 | public int PageNumber { get; } 11 | public int PageSize { get; } 12 | 13 | public GetTransactionsByProductIdQuery(Guid productId, int pageNumber, int pageSize) 14 | { 15 | ProductId = productId; 16 | PageNumber = pageNumber; 17 | PageSize = pageSize; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/GetTransactionsByUserIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 6 | { 7 | public class GetTransactionsByUserIdQuery : IRequest> 8 | { 9 | public Guid UserId { get; } 10 | public int PageNumber { get; } 11 | public int PageSize { get; } 12 | 13 | public GetTransactionsByUserIdQuery(Guid userId, int pageNumber, int pageSize) 14 | { 15 | UserId = userId; 16 | PageNumber = pageNumber; 17 | PageSize = pageSize; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/InitializeTransactionCommand.cs: -------------------------------------------------------------------------------- 1 | using CSharpFunctionalExtensions; 2 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 6 | { 7 | public record InitializeTransactionCommand : IRequest> 8 | { 9 | public string Email { get; set; } 10 | public decimal Amount { get; set; } 11 | public Guid ProductId { get; set; } 12 | } 13 | } 14 | 15 | public record ProductInitialized(Guid ProductId, string Type = nameof(ProductInitialized)); -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/InitializeTransactionRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 2 | { 3 | public record InitializeTransactionRequest : PaymentRequestBase 4 | { 5 | public string Email { get; set; } 6 | public string Amount { get; set; } 7 | public string Reference { get; set; } 8 | public string CallbackUrl { get; set; } 9 | public string Metadata { get; set; } 10 | 11 | public InitializeTransactionRequest(string amount, string email, string refernce) 12 | { 13 | Amount = amount; 14 | Email = email; 15 | Reference = refernce; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/InitiateSubscriptionTransactionCommand.cs: -------------------------------------------------------------------------------- 1 | using CSharpFunctionalExtensions; 2 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 6 | { 7 | public class InitiateSubscriptionTransactionCommand : IRequest> 8 | { 9 | public string Email { get; set; } 10 | public decimal Amount { get; set; } 11 | public string Plan { get; set; } 12 | public string Frequency { get; set; } 13 | } 14 | 15 | public record SubscriptionInitialized(Guid SubId, string Type = nameof(SubscriptionInitialized)); 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/PaymentQueryBase.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 4 | { 5 | public record PaymentQueryBase 6 | { 7 | public T Param { get; set; } 8 | 9 | /// 10 | /// Required - The current business' SECRET KEY 11 | /// 12 | [JsonIgnore] 13 | public string BusinessAuthorizationToken { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/PaymentRequestBase.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 4 | { 5 | public abstract record PaymentRequestBase 6 | { 7 | /// 8 | /// The current business' SECRET KEY 9 | /// 10 | [JsonIgnore] 11 | public string BusinessAuthorizationToken { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/VerifyTransactionQuery.cs: -------------------------------------------------------------------------------- 1 | using CSharpFunctionalExtensions; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 5 | { 6 | public record VerifyTransactionQuery(string Reference) : IRequest>; 7 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Requests/VerifyTransactionRequest.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.Core; 2 | 3 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests 4 | { 5 | public record VerifyTransactionRequest : PaymentQueryBase 6 | { 7 | public VerifyTransactionRequest(string transactionReference) 8 | { 9 | if (transactionReference.IsEmpty()) 10 | throw new ArgumentNullException(nameof(transactionReference)); 11 | 12 | Param = transactionReference; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Responses/InitializeTransactionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses 2 | { 3 | public class InitializeTransactionResponse 4 | { 5 | public bool Status { get; set; } 6 | public string Message { get; set; } 7 | public InitializeTransactionData Data { get; set; } 8 | } 9 | 10 | public class InitializeTransactionData 11 | { 12 | public string authorization_url { get; set; } 13 | public string access_code { get; set; } 14 | public string Reference { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Dtos/Responses/InitiateSubscriptionTransactionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses 2 | { 3 | public class InitiateSubscriptionTransactionResponse : InitializeTransactionResponse 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Mappers/TransactionMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Mappers 5 | { 6 | public class TransactionMapperProfile : AutoMapper.Profile 7 | { 8 | public TransactionMapperProfile() 9 | { 10 | CreateMap(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/ExternalIntegrations/PaymentIntegrations/Paystack/Services/IPaystackClient.cs: -------------------------------------------------------------------------------- 1 | using CSharpFunctionalExtensions; 2 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests; 3 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Responses; 4 | 5 | namespace Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Services 6 | { 7 | public interface IPaystackClient 8 | { 9 | Task> VerifyTransaction(VerifyTransactionRequest request); 10 | Task> VerifyTransfer(VerifyTransactionRequest request); 11 | Task> InitializeTransaction(InitializeTransactionRequest request); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Commands/CreateFaqCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Faq.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Faq.Commands 10 | { 11 | public class CreateFaqCommand : IRequest 12 | { 13 | public CreateFaqCommand(CreateFaqRequestDto faqRequest) 14 | { 15 | FaqRequestDto = faqRequest; 16 | } 17 | public CreateFaqRequestDto FaqRequestDto { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Commands/DeleteFaqCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Faq.Dtos; 2 | using MediatR; 3 | using System; 4 | 5 | namespace Hng.Application.Features.Faq.Commands 6 | { 7 | public class DeleteFaqCommand : IRequest 8 | { 9 | public DeleteFaqCommand(Guid id) 10 | { 11 | Id = id; 12 | } 13 | 14 | public Guid Id { get; } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Commands/UpdateFaqCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Faq.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Faq.Commands 5 | { 6 | public class UpdateFaqCommand : IRequest 7 | { 8 | public UpdateFaqCommand(Guid id, UpdateFaqRequestDto faqRequest) 9 | { 10 | Id = id; 11 | FaqRequestDto = faqRequest; 12 | } 13 | public Guid Id { get; } 14 | public UpdateFaqRequestDto FaqRequestDto { get; } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Dtos/CreateFaqRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Faq.Dtos 9 | { 10 | public class CreateFaqRequestDto 11 | { 12 | [JsonPropertyName("question")] 13 | public string Question { get; set; } 14 | [JsonPropertyName("answer")] 15 | public string Answer { get; set; } 16 | [JsonPropertyName("category")] 17 | public string Category { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Dtos/DeleteFaqResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Faq.Dtos 4 | { 5 | public class DeleteFaqResponseDto 6 | { 7 | public int StatusCode { get; set; } 8 | [JsonPropertyName("message")] 9 | public string Message { get; set; } 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Dtos/UpdateFaqRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Faq.Dtos 9 | { 10 | public class UpdateFaqRequestDto 11 | { 12 | [JsonPropertyName("question")] 13 | public string Question { get; set; } 14 | [JsonPropertyName("answer")] 15 | public string Answer { get; set; } 16 | [JsonPropertyName("category")] 17 | public string Category { get; set; } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Dtos/UpdateFaqResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Faq.Dtos 4 | { 5 | public class UpdateFaqResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | public FaqData Data { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Faq/Queries/GetAllFaqsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Faq.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Faq.Queries 10 | { 11 | public class GetAllFaqsQuery : IRequest> 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Command/CreateHelpCenterTopicCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.HelpCenter.Command 10 | { 11 | public class CreateHelpCenterTopicCommand : IRequest> 12 | { 13 | public CreateHelpCenterTopicCommand(CreateHelpCenterTopicRequestDto request) 14 | { 15 | Request = request; 16 | } 17 | 18 | public CreateHelpCenterTopicRequestDto Request { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Command/DeleteHelpCenterTopicCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.HelpCenter.Command 10 | { 11 | public class DeleteHelpCenterTopicCommand : IRequest> 12 | { 13 | public Guid Id { get; set; } 14 | 15 | public DeleteHelpCenterTopicCommand(Guid id) 16 | { 17 | Id = id; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Command/UpdateHelpCenterTopicCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.HelpCenter.Command 10 | { 11 | public class UpdateHelpCenterTopicCommand : IRequest> 12 | { 13 | public Guid Id { get; set; } 14 | public UpdateHelpCenterTopicRequestDto Request { get; set; } 15 | 16 | public UpdateHelpCenterTopicCommand(Guid id, UpdateHelpCenterTopicRequestDto request) 17 | { 18 | Id = id; 19 | Request = request; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Dtos/CreateHelpCenterTopicRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.HelpCenter.Dtos 9 | { 10 | public class CreateHelpCenterTopicRequestDto 11 | { 12 | [JsonPropertyName("title")] 13 | public string Title { get; set; } 14 | [JsonPropertyName("content")] 15 | public string Content { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Dtos/HelpCenterResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.HelpCenter.Dtos 9 | { 10 | public class HelpCenterResponseDto 11 | { 12 | [JsonPropertyName("status_code")] 13 | public int StatusCode { get; set; } 14 | [JsonPropertyName("message")] 15 | public string Message { get; set; } 16 | [JsonPropertyName("data")] 17 | public T Data { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Dtos/HelpCenterTopicResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.HelpCenter.Dtos 9 | { 10 | public class HelpCenterTopicResponseDto 11 | { 12 | public Guid Id { get; set; } 13 | [JsonPropertyName("title")] 14 | public string Title { get; set; } 15 | [JsonPropertyName("content")] 16 | public string Content { get; set; } 17 | [JsonPropertyName("author")] 18 | public string Author { get; set; } = "Admin"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Dtos/SearchHelpCenterTopicsRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.HelpCenter.Dtos 9 | { 10 | public class SearchHelpCenterTopicsRequestDto 11 | { 12 | [JsonPropertyName("title")] 13 | public string Title { get; set; } 14 | [JsonPropertyName("content")] 15 | public string Content { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Dtos/UpdateHelpCenterTopicRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.HelpCenter.Dtos 9 | { 10 | public class UpdateHelpCenterTopicRequestDto 11 | { 12 | [JsonPropertyName("title")] 13 | public string Title { get; set; } 14 | [JsonPropertyName("content")] 15 | public string Content { get; set; } 16 | [JsonPropertyName("author")] 17 | public string Author { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Queries/GetHelpCenterTopicByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.HelpCenter.Queries 10 | { 11 | public class GetHelpCenterTopicByIdQuery : IRequest> 12 | { 13 | public Guid Id { get; set; } 14 | 15 | public GetHelpCenterTopicByIdQuery(Guid id) 16 | { 17 | Id = id; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Queries/GetHelpCenterTopicsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.HelpCenter.Queries 10 | { 11 | public class GetHelpCenterTopicsQuery : IRequest>> 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/HelpCenter/Queries/SearchHelpCenterTopicsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.HelpCenter.Queries 10 | { 11 | public class SearchHelpCenterTopicsQuery : IRequest>> 12 | { 13 | public SearchHelpCenterTopicsRequestDto SearchRequest { get; } 14 | 15 | public SearchHelpCenterTopicsQuery(SearchHelpCenterTopicsRequestDto searchRequest) 16 | { 17 | SearchRequest = searchRequest; 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Commands/CreateJobCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Jobs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Jobs.Commands 5 | { 6 | public class CreateJobCommand(CreateJobDto createJobDto) : IRequest 7 | { 8 | public CreateJobDto JobBody { get; } = createJobDto; 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Commands/DeleteJobByIdCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | 3 | namespace Hng.Application.Features.Jobs.Commands; 4 | 5 | public class DeleteJobByIdCommand : IRequest 6 | { 7 | public Guid JobId { get; } 8 | 9 | public DeleteJobByIdCommand(Guid jobId) 10 | { 11 | JobId = jobId; 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Commands/UpdateJobCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Jobs.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Jobs.Commands 10 | { 11 | public class UpdateJobCommand(UpdateJobDto updateJob, Guid jobId) : IRequest 12 | { 13 | public UpdateJobDto UpdateJob { get; set; } = updateJob; 14 | public Guid JobId { get; set; } = jobId; 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Dtos/CreateJobDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Hng.Domain.Enums; 3 | 4 | namespace Hng.Application.Features.Jobs.Dtos; 5 | 6 | public class CreateJobDto 7 | { 8 | [JsonPropertyName("title")] 9 | public string Title { get; set; } 10 | 11 | [JsonPropertyName("description")] 12 | public string Description { get; set; } 13 | 14 | [JsonPropertyName("location")] 15 | public string Location { get; set; } 16 | 17 | [JsonPropertyName("salary")] 18 | public double Salary { get; set; } 19 | 20 | [JsonPropertyName("level")] 21 | public ExperienceLevel Level { get; set; } 22 | 23 | [JsonPropertyName("company")] 24 | public string Company { get; set; } 25 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Dtos/GetJobRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Jobs.Dtos; 4 | 5 | public class GetJobRequestDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public JobDto Data { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Dtos/JobDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Hng.Domain.Enums; 3 | 4 | namespace Hng.Application.Features.Jobs.Dtos; 5 | 6 | public class JobDto 7 | { 8 | [JsonPropertyName("id")] 9 | public Guid Id { get; set; } 10 | 11 | [JsonPropertyName("title")] 12 | public string Title { get; set; } 13 | 14 | [JsonPropertyName("description")] 15 | public string Description { get; set; } 16 | 17 | [JsonPropertyName("location")] 18 | public string Location { get; set; } 19 | 20 | [JsonPropertyName("salary")] 21 | public double Salary { get; set; } 22 | 23 | [JsonPropertyName("level")] 24 | public ExperienceLevel Level { get; set; } 25 | 26 | [JsonPropertyName("company")] 27 | public string Company { get; set; } 28 | 29 | [JsonPropertyName("date-posted")] 30 | public DateTime DatePosted { get; set; } 31 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Dtos/UpdateJobResponseDto.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.Json.Serialization; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Jobs.Dtos 10 | { 11 | public class UpdateJobResponseDto 12 | { 13 | [JsonPropertyName("status_code")] 14 | public int StatusCode { get; set; } 15 | 16 | [JsonPropertyName("message")] 17 | public string Message { get; set; } 18 | 19 | [JsonPropertyName("success")] 20 | public bool Success { get; set; } 21 | 22 | [JsonPropertyName("data")] 23 | public Job Data { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Mappers/JobMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Jobs.Dtos; 2 | using Hng.Domain.Entities; 3 | using Profile = AutoMapper.Profile; 4 | 5 | namespace Hng.Application.Features.Jobs.Mappers; 6 | 7 | public class JobMapperProfile : Profile 8 | { 9 | public JobMapperProfile() 10 | { 11 | CreateMap(); 12 | CreateMap() 13 | .ReverseMap(); 14 | 15 | CreateMap() 16 | .ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null)); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Queries/GetJobByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Jobs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Jobs.Queries; 5 | 6 | public class GetJobByIdQuery(Guid id) : IRequest 7 | { 8 | public Guid JobId { get; } = id; 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Jobs/Queries/GetJobsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Jobs.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Jobs.Queries; 5 | 6 | public class GetJobsQuery : IRequest>; -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Commands/CreateLanguageCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Languages.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Hng.Application.Features.Languages.Commands 7 | { 8 | public class CreateLanguageCommand : IRequest> 9 | { 10 | [JsonPropertyName("name")] 11 | public string Name { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Commands/DeleteLanguageCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Languages.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Languages.Commands 5 | { 6 | public class DeleteLanguageCommand : IRequest 7 | { 8 | public Guid Id { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Commands/UpdateLanguageCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Languages.Dtos; 2 | using MediatR; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Hng.Application.Features.Languages.Commands 6 | { 7 | public class UpdateLanguageCommand : IRequest 8 | { 9 | public Guid Id { get; set; } 10 | 11 | [JsonPropertyName("name")] 12 | public string Name { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Dtos/CreateLanguageRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Languages.Dtos 4 | { 5 | public class CreateLanguageRequestDto 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Dtos/LanguageDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Languages.Dtos 4 | { 5 | public class LanguageDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | 10 | [JsonPropertyName("name")] 11 | public string Name { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Dtos/LanguageResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Languages.Dtos 4 | { 5 | public class LanguageResponseDto 6 | { 7 | [JsonPropertyName("language")] 8 | public LanguageDto Data { get; set; } 9 | 10 | [JsonPropertyName("status_code")] 11 | public int StatusCode { get; set; } 12 | 13 | [JsonPropertyName("message")] 14 | public string Message { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Dtos/UpdateLanguageRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Languages.Dtos 4 | { 5 | public class UpdateLanguageRequestDto 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Mappers/LanguageMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Languages.Commands; 2 | using Hng.Application.Features.Languages.Dtos; 3 | using Hng.Domain.Entities; 4 | 5 | namespace Hng.Application.Features.Languages.Mappers 6 | { 7 | public class LanguageMapperProfile : AutoMapper.Profile 8 | { 9 | public LanguageMapperProfile() 10 | { 11 | CreateMap().ReverseMap(); 12 | CreateMap(); 13 | CreateMap(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Queries/GetAllLanguagesQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Languages.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Languages.Queries 6 | { 7 | public class GetAllLanguagesQuery : BaseQueryParameters, IRequest>> 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Languages/Queries/GetLanguageByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Languages.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Languages.Queries 5 | { 6 | public class GetLanguageByIdQuery : IRequest 7 | { 8 | public Guid Id { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/LastLoginUser/Command/LogoutCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.LastLoginUser.Dto; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.LastLoginUser.Command 10 | { 11 | public class LogoutCommand : IRequest>> 12 | { 13 | public Guid UserId { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/LastLoginUser/Dto/LastLoginDto.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.LastLoginUser.Dto 9 | { 10 | public class LastLoginDto 11 | { 12 | [JsonProperty("id")] 13 | public Guid Id { get; set; } 14 | 15 | [JsonProperty("user_id")] 16 | public Guid UserId { get; set; } 17 | 18 | [JsonProperty("login_time")] 19 | public DateTime LoginTime { get; set; } 20 | 21 | [JsonProperty("ip_address")] 22 | public string IPAddress { get; set; } 23 | 24 | [JsonProperty("logout_time")] 25 | public DateTime? LogoutTime { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/LastLoginUser/Dto/LastLoginResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.LastLoginUser.Dto 9 | { 10 | public class LastLoginResponseDto 11 | { 12 | [JsonPropertyName("status_code")] 13 | public int StatusCode { get; set; } 14 | [JsonPropertyName("message")] 15 | public string Message { get; set; } 16 | [JsonPropertyName("data")] 17 | public T Data { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/LastLoginUser/Mapper/LastloginMapper.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Faq.Dtos; 2 | using Hng.Application.Features.LastLoginUser.Dto; 3 | using Hng.Domain.Entities; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Hng.Application.Features.LastLoginUser.Mapper 11 | { 12 | public class LastloginMapper : AutoMapper.Profile 13 | { 14 | public LastloginMapper() 15 | { 16 | CreateMap() 17 | .ReverseMap(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/LastLoginUser/Queries/GetLastLoginQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.HelpCenter.Dtos; 2 | using Hng.Application.Features.LastLoginUser.Dto; 3 | using MediatR; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Hng.Application.Features.LastLoginUser.Queries 11 | { 12 | public class GetLastLoginQuery : IRequest>> 13 | { 14 | public Guid UserId { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/NewsLetterSubscription/Commands/AddSubscriberCommand.cs: -------------------------------------------------------------------------------- 1 | 2 | using Hng.Application.Features.NewsLetterSubscription.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.NewsLetterSubscription.Commands 6 | { 7 | public class AddSubscriberCommand : IRequest 8 | { 9 | public AddSubscriberCommand(NewsLetterSubscriptionDto newsLetterSubscriptionDto) 10 | { 11 | NewsLetterSubscriptionBody = newsLetterSubscriptionDto; 12 | } 13 | 14 | public NewsLetterSubscriptionDto NewsLetterSubscriptionBody { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/NewsLetterSubscription/Commands/DeleteSubscriberCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.NewsLetterSubscription.Commands 5 | { 6 | public class DeleteSubscriberCommand : IRequest> 7 | { 8 | public Guid Id { get; } 9 | 10 | public DeleteSubscriberCommand(Guid id) 11 | { 12 | Id = id; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/NewsLetterSubscription/Dtos/NewsLetterSubscriptionDto.cs: -------------------------------------------------------------------------------- 1 | 2 | 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | namespace Hng.Application.Features.NewsLetterSubscription.Dtos 6 | { 7 | public class NewsLetterSubscriptionDto 8 | { 9 | [EmailAddress] 10 | public string Email { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/NewsLetterSubscription/Mappers/NewsLetterMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.NewsLetterSubscription.Dtos; 2 | using Hng.Domain.Entities; 3 | using Profile = AutoMapper.Profile; 4 | 5 | namespace Hng.Application.Features.NewsLetterSubscription.Mappers 6 | { 7 | public class NewsLetterMapperProfile : Profile 8 | { 9 | public NewsLetterMapperProfile() 10 | { 11 | CreateMap() 12 | .ReverseMap(); 13 | } 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Commands/CreateNotificationCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Commands 5 | { 6 | public class CreateNotificationCommand : IRequest 7 | { 8 | public CreateNotificationCommand(CreateNotificationDto createNotificationDto) 9 | { 10 | Notification = createNotificationDto; 11 | } 12 | public CreateNotificationDto Notification { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Commands/CreateNotificationSettingsCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Commands 5 | { 6 | public class CreateNotificationSettingsCommand : IRequest 7 | { 8 | public CreateNotificationSettingsCommand(CreateNotificationSettingsDto notificationSettingsDto) 9 | { 10 | NotificationBody = notificationSettingsDto; 11 | } 12 | public CreateNotificationSettingsDto NotificationBody { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Commands/DeleteAllNotificationsCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | 3 | namespace Hng.Application.Features.Notifications.Commands 4 | { 5 | public class DeleteAllNotificationsCommand : IRequest 6 | { 7 | public DeleteAllNotificationsCommand() 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Commands/DeleteNotificationByIdCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | 3 | namespace Hng.Application.Features.Notifications.Commands 4 | { 5 | public class DeleteNotificationByIdCommand : IRequest 6 | { 7 | public Guid NotificationId { get; set; } 8 | 9 | public DeleteNotificationByIdCommand(Guid notificationId) 10 | { 11 | NotificationId = notificationId; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Commands/MarkAllCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Commands 5 | { 6 | public class MarkAllCommand : IRequest> 7 | { 8 | public bool IsRead { get; set; } 9 | 10 | public MarkAllCommand(bool isRead) 11 | { 12 | IsRead = isRead; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Commands/UpdateNotificationCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Commands 5 | { 6 | public class UpdateNotificationCommand : IRequest 7 | { 8 | public Guid NotificationId { get; set; } 9 | public bool IsRead { get; set; } 10 | 11 | public UpdateNotificationCommand(Guid notificationId, bool isRead) 12 | { 13 | NotificationId = notificationId; 14 | IsRead = isRead; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Dtos/CreateNotificationDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Notifications.Dtos 4 | { 5 | public class CreateNotificationDto 6 | { 7 | [JsonPropertyName("message")] 8 | public string Message { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Dtos/GetNotificationsResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Notifications.Dtos 4 | { 5 | public class GetNotificationsResponseDto 6 | { 7 | [JsonPropertyName("total_notification_count")] 8 | public int TotalNotificationCount { get; set; } 9 | [JsonPropertyName("total_unread_notification_count")] 10 | public int TotalUnreadNotificationCount { get; set; } 11 | public List Notifications { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Dtos/NotificationDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Notifications.Dtos 4 | { 5 | public class NotificationDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | [JsonPropertyName("user_id")] 10 | public Guid UserId { get; set; } 11 | [JsonPropertyName("is_read")] 12 | public bool IsRead { get; set; } 13 | [JsonPropertyName("message")] 14 | public string Message { get; set; } 15 | [JsonPropertyName("created_at")] 16 | public DateTime CreatedAt { get; set; } 17 | [JsonPropertyName("updated_at")] 18 | public DateTime? UpdatedAt { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Dtos/NotificationResult.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | 3 | namespace Hng.Application.Features.Notifications.Dtos 4 | { 5 | public class NotificationResult 6 | { 7 | public NotificationDto Notification { get; set; } 8 | public FailureResponseDto FailureResponse { get; set; } 9 | public SuccessResponseDto SuccessResponse { get; set; } 10 | public bool IsSuccess { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Dtos/UpdateNotificationDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | namespace Hng.Application.Features.Notifications.Dtos 4 | { 5 | public class UpdateNotificationDto 6 | { 7 | [JsonPropertyName("is_read")] 8 | public bool IsRead { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Mappers/NotificationMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.Notifications.Mappers 5 | { 6 | public class NotificationMapperProfile : AutoMapper.Profile 7 | { 8 | public NotificationMapperProfile() 9 | { 10 | CreateMap(); 11 | CreateMap(); 12 | CreateMap(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Queries/GetAllNotificationsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Queries 5 | { 6 | public class GetAllNotificationsQuery : IRequest 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Queries/GetNotificationSettingsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Queries 5 | { 6 | public class GetNotificationSettingsQuery : IRequest 7 | { 8 | public Guid UserId { get; } 9 | 10 | public GetNotificationSettingsQuery(Guid userId) 11 | { 12 | UserId = userId; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Notifications/Queries/GetNotificationsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Notifications.Queries 5 | { 6 | public class GetNotificationsQuery : IRequest 7 | { 8 | public bool? IsRead { get; set; } 9 | 10 | public GetNotificationsQuery(bool? isRead) 11 | { 12 | IsRead = isRead; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Commands/AcceptInviteCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.OrganisationInvite.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.OrganisationInvite.Commands; 6 | 7 | public record AcceptInviteCommand(AcceptInviteDto Invite) : IRequest; 8 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Commands/CreateAndSendInvitesCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.OrganisationInvite.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.OrganisationInvite.Commands; 6 | 7 | public record CreateAndSendInvitesCommand(CreateAndSendInvitesDto Details) : IRequest; 8 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Dtos/AcceptInviteDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Hng.Application.Shared.Validators; 3 | 4 | namespace Hng.Application.Features.OrganisationInvite.Dtos; 5 | 6 | public record AcceptInviteDto 7 | { 8 | [JsonPropertyName("invite_token_guid")] 9 | [ValidGuid] 10 | public string Token { get; init; } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Dtos/CreateAndSendInvitesDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Text.Json.Serialization; 3 | using Hng.Application.Shared.Dtos.Validators; 4 | using Hng.Application.Shared.Validators; 5 | using Hng.Domain.Entities; 6 | 7 | namespace Hng.Application.Features.OrganisationInvite.Dtos; 8 | 9 | public record CreateAndSendInvitesDto 10 | { 11 | 12 | [JsonPropertyName("emails")] 13 | [EmailCollection] 14 | [MinLength(1, ErrorMessage = "The email list cannot be empty")] 15 | public IEnumerable Emails { get; init; } 16 | 17 | [JsonPropertyName("org_id")] 18 | [ValidGuid(AllowEmpty = true)] 19 | public string OrgId { get; init; } 20 | 21 | [JsonIgnore] 22 | public Guid InviterId { get; set; } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Dtos/CreateAndSendInvitesResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.OrganisationInvite.Dtos; 4 | 5 | public record CreateAndSendInvitesResponseDto 6 | { 7 | [JsonPropertyName("invitations")] 8 | public IEnumerable Invitations { get; set; } 9 | } 10 | 11 | public record InviteDto 12 | { 13 | [JsonPropertyName("email")] 14 | public string Email { get; init; } 15 | 16 | [JsonPropertyName("invite_link")] 17 | public string InviteLink { get; set; } = string.Empty; 18 | 19 | [JsonPropertyName("error")] 20 | 21 | public string Error { get; set; } = string.Empty; 22 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Dtos/CreateUniqueOrganisationLinkDto.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.OrganisationInvite.Dtos; 5 | 6 | public record CreateUniqueOrganizationInviteLinkDto 7 | { 8 | [JsonPropertyName("org_id")] 9 | public string OrganizationId { get; init; } 10 | 11 | [JsonIgnore] 12 | public Guid UserId { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Dtos/GetUniqueOrganisationLinkDto.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.OrganisationInvite.Dtos; 5 | 6 | public record GetUniqueOrganizationInviteLinkDto 7 | { 8 | public string OrganizationId { get; init; } 9 | 10 | [JsonIgnore] 11 | public Guid UserId { get; set; } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Queries/GetUniqueOrganisationLinkQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.OrganisationInvite.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.OrganisationInvite.Queries; 6 | 7 | public record GetUniqueOrganizationLinkQuery(GetUniqueOrganizationInviteLinkDto Details) : IRequest; 8 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Validators/IRequestValidator.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Hng.Infrastructure.Repository.Interface; 3 | using Hng.Infrastructure.Utilities; 4 | using Hng.Infrastructure.Utilities.Results; 5 | 6 | namespace Hng.Application.Features.OrganisationInvite.Validators; 7 | 8 | public interface IRequestValidator 9 | { 10 | public Task> OrganizationExistsAsync(Guid orgId, IRepository repository); 11 | public Task> UserIsOrganizationOwnerAsync(Guid userId, Guid orgId, IRepository orgRepository); 12 | public Task> InviteDoesNotExistAsync( 13 | Guid orgId, 14 | string inviteeEmail, 15 | IRepository inviteRepository); 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Validators/ValidationErrors/ImplicitErrorOperator.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Hng.Infrastructure.Utilities.Results; 3 | 4 | namespace Hng.Application.Features.OrganisationInvite.Validators.ValidationErrors; 5 | 6 | public class ImplicitErrorOperator(string Message) : Error(Message) 7 | { 8 | public static implicit operator Result(ImplicitErrorOperator error) 9 | { 10 | return Result.Failure(error); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Validators/ValidationErrors/InviteAlreadyExistsError.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Hng.Infrastructure.Utilities.Results; 3 | 4 | namespace Hng.Application.Features.OrganisationInvite.Validators.ValidationErrors; 5 | public class InviteAlreadyExistsError : Error 6 | { 7 | private InviteAlreadyExistsError(string Message) : base(Message) { } 8 | 9 | public static InviteAlreadyExistsError FromEmail(string email) 10 | { 11 | return new InviteAlreadyExistsError($"An invite already exists for the email {email}"); 12 | } 13 | 14 | public static implicit operator Result(InviteAlreadyExistsError error) => Result.Failure(error); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Validators/ValidationErrors/OrganisationDoesNotExistError.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Hng.Application.Features.OrganisationInvite.Validators.ValidationErrors; 3 | 4 | public class OrganisationDoesNotExistError : ImplicitErrorOperator 5 | { 6 | private OrganisationDoesNotExistError(string Message) : base(Message) { } 7 | 8 | public static OrganisationDoesNotExistError FromId(Guid id) 9 | { 10 | return new OrganisationDoesNotExistError($"No organisation exists for the id {id}"); 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/OrganisationInvite/Validators/ValidationErrors/UserIsNotOwnerError.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Hng.Application.Features.OrganisationInvite.Validators.ValidationErrors; 3 | public class UserIsNotOwnerError : ImplicitErrorOperator 4 | { 5 | private UserIsNotOwnerError(string Message) : base(Message) { } 6 | 7 | public static UserIsNotOwnerError FromIds(Guid userId, Guid organizationId) 8 | { 9 | return new UserIsNotOwnerError($"You are not the owner of the specified organization"); 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Commands/CreateOrganizationCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Organisations.Commands; 5 | 6 | public class CreateOrganizationCommand : IRequest 7 | { 8 | public CreateOrganizationCommand(CreateOrganizationDto createOrganizationDto) 9 | { 10 | OrganizationBody = createOrganizationDto; 11 | } 12 | 13 | public CreateOrganizationDto OrganizationBody { get; } 14 | 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Commands/DeleteUserOrganizationCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | 3 | namespace Hng.Application.Features.Organisations.Commands 4 | { 5 | public class DeleteUserOrganizationCommand : IRequest 6 | { 7 | public DeleteUserOrganizationCommand(Guid organizationId) 8 | { 9 | OrganizationId = organizationId; 10 | } 11 | 12 | public Guid OrganizationId { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Commands/UpdateOrganizationCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Organisations.Commands; 5 | 6 | public class UpdateOrganizationCommand : IRequest 7 | { 8 | public UpdateOrganizationCommand(Guid orgId, UpdateOrganizationDto updateOrganizationDto) 9 | { 10 | OrgId = orgId; 11 | OrganizationBody = updateOrganizationDto; 12 | } 13 | 14 | public Guid OrgId { get; } 15 | public UpdateOrganizationDto OrganizationBody { get; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Dtos/CreateOrganisationResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Organisations.Dtos; 4 | 5 | public class CreateOrganisationResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public OrganizationDto Data { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Dtos/GetOrganisationResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Organisations.Dtos; 4 | 5 | public class GetOrganisationResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public OrganizationDto Data { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Dtos/UpdateOrganizationResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Organisations.Dtos 4 | { 5 | public class UpdateOrganizationResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public OrganizationDto Data { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Mappers/OrganizationMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.Organisations.Mappers 5 | { 6 | public class OrganizationMapperProfile : AutoMapper.Profile 7 | { 8 | public OrganizationMapperProfile() 9 | { 10 | CreateMap() 11 | .ReverseMap(); 12 | 13 | CreateMap(); 14 | CreateMap() 15 | .ForMember(dest => dest.Users, opt => opt.MapFrom(src => src.Users)); 16 | CreateMap().ReverseMap(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Queries/GetAllUsersOrganizationsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Organisations.Queries 6 | { 7 | public class GetAllUsersOrganizationsQuery : IRequest>> 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Queries/GetAllUsersQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Organisations.Queries 5 | { 6 | public class GetAllUsersQuery : IRequest 7 | { 8 | public GetAllUsersQuery(Guid organizationId) 9 | { 10 | OrganizationId = organizationId; 11 | } 12 | 13 | public Guid OrganizationId { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Organisations/Queries/GetOrganizationByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Organisations.Queries; 5 | 6 | public class GetOrganizationByIdQuery(Guid id) : IRequest 7 | { 8 | public Guid OrganizationId { get; } = id; 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Commands/AddProductsCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Products.Commands 10 | { 11 | public class AddProductsCommand : IRequest 12 | { 13 | public AddProductsCommand(List productCreation) 14 | { 15 | productBody = productCreation; 16 | } 17 | 18 | public List productBody { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Commands/CreateProductCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Products.Commands 5 | { 6 | public class CreateProductCommand : IRequest 7 | { 8 | public Guid OrgId { get; set; } 9 | public ProductCreationDto ProductDto { get; set; } 10 | 11 | public CreateProductCommand(Guid orgId, ProductCreationDto productDto) 12 | { 13 | OrgId = orgId; 14 | ProductDto = productDto; 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Commands/DeleteProductByIdCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Products.Commands 5 | { 6 | public class DeleteProductByIdCommand : IRequest 7 | { 8 | public DeleteProductByIdCommand(Guid id) 9 | { 10 | ProductId = id; 11 | } 12 | 13 | public Guid ProductId { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Commands/UpdateProductCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Products.Commands 5 | { 6 | public class UpdateProductCommand : IRequest 7 | { 8 | public UpdateProductCommand(Guid id, UpdateProductDto updateProductDto) 9 | { 10 | Id = id; 11 | UpdateProductDto = updateProductDto; 12 | } 13 | 14 | public Guid Id { get; } 15 | public UpdateProductDto UpdateProductDto { get; } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Dtos/GetProductsQueryParameters.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Products.Dtos 4 | { 5 | public class GetProductsQueryParameters 6 | { 7 | [JsonPropertyName("page_size")] 8 | public int PageSize { get; set; } 9 | [JsonPropertyName("page_number")] 10 | public int PageNumber { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Dtos/UpdateProductDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Products.Dtos 4 | { 5 | public class UpdateProductDto 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | [JsonPropertyName("price")] 10 | public decimal Price { get; set; } 11 | [JsonPropertyName("description")] 12 | public string Description { get; set; } 13 | [JsonPropertyName("category")] 14 | public string Category { get; set; } 15 | 16 | [JsonPropertyName("image_url")] 17 | public string ImageUrl { get; set; } 18 | 19 | [JsonPropertyName("quantity")] 20 | public int Quantity { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Mappers/ProductMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.Products.Mappers 5 | { 6 | public class ProductMapperProfile : AutoMapper.Profile 7 | { 8 | public ProductMapperProfile() 9 | { 10 | CreateMap().ReverseMap(); 11 | CreateMap(); 12 | CreateMap(); 13 | CreateMap(); 14 | CreateMap().ReverseMap(); 15 | } 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Queries/GetAllProductsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Products.Queries 5 | { 6 | public class GetAllProductsQuery : IRequest> 7 | { 8 | public Guid OrgId { get; } 9 | 10 | public GetAllProductsQuery(Guid orgId) 11 | { 12 | OrgId = orgId; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Queries/GetProductByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MediatR; 3 | using Hng.Application.Features.Products.Dtos; 4 | 5 | namespace Hng.Application.Features.Products.Queries 6 | { 7 | public class GetProductByIdQuery : IRequest 8 | { 9 | public Guid Id { get; set; } 10 | 11 | public GetProductByIdQuery(Guid id) 12 | { 13 | Id = id; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Queries/GetProductByNameQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Products.Queries 10 | { 11 | public class GetProductByNameQuery : IRequest> 12 | { 13 | public string Name { get; set; } 14 | 15 | public GetProductByNameQuery(string name) 16 | { 17 | Name = name; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Queries/GetProductsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using Hng.Application.Features.Subscriptions.Dtos.Requests; 3 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 4 | using Hng.Application.Shared.Dtos; 5 | using MediatR; 6 | 7 | namespace Hng.Application.Features.Products.Queries 8 | { 9 | public class GetProductsQuery : IRequest> 10 | { 11 | public GetProductsQuery(GetProductsQueryParameters parameters) 12 | { 13 | productsQueryParameters = parameters; 14 | } 15 | 16 | public GetProductsQueryParameters productsQueryParameters { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Queries/GetUserProductsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Products.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Products.Queries 6 | { 7 | public class GetUserProductsQuery : IRequest> 8 | { 9 | public GetUserProductsQuery(GetProductsQueryParameters parameters) 10 | { 11 | productsQueryParameters = parameters; 12 | } 13 | 14 | public GetProductsQueryParameters productsQueryParameters { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Products/Validators/UpdateProductDtoValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Hng.Application.Features.Products.Dtos; 3 | 4 | namespace Hng.Application.Features.Products.Validators 5 | { 6 | public class UpdateProductDtoValidator : AbstractValidator 7 | { 8 | public UpdateProductDtoValidator() 9 | { 10 | RuleFor(x => x.Name) 11 | .NotEmpty().WithMessage("product_name is required"); 12 | 13 | RuleFor(x => x.Price) 14 | .GreaterThan(0).WithMessage("price must be a positive number"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Profiles/Dtos/DeleteProfilePictureDto.cs: -------------------------------------------------------------------------------- 1 | using CSharpFunctionalExtensions; 2 | using MediatR; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Hng.Application.Features.Profiles.Dtos 6 | { 7 | public record DeleteProfilePictureDto : IRequest> 8 | { 9 | } 10 | 11 | public record DeleteProfilePictureResponseDto 12 | { 13 | [JsonPropertyName("message")] 14 | public string Message { get; set; } 15 | 16 | [JsonPropertyName("status_code")] 17 | public int StatusCode { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Profiles/Mappers/ProfileMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ExternalIntegrations.PaymentIntegrations.Paystack.Dtos.Requests; 2 | using Hng.Application.Features.Profiles.Dtos; 3 | using Hng.Domain.Entities; 4 | 5 | namespace Hng.Application.Features.Profiles.Mappers 6 | { 7 | public class ProfileMapperProfile : AutoMapper.Profile 8 | { 9 | public ProfileMapperProfile() 10 | { 11 | CreateMap().ReverseMap(); 12 | 13 | CreateMap() 14 | .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.User.Email)) 15 | .ReverseMap(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Command/AssignRoleCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Roles.Command 5 | { 6 | public class AssignRoleCommand : IRequest> 7 | { 8 | public AssignRoleCommand(Guid orgId, Guid roleId, Guid userId) 9 | { 10 | OrgId = orgId; 11 | RoleId = roleId; 12 | UserId = userId; 13 | } 14 | 15 | public Guid OrgId { get; } 16 | public Guid RoleId { get; } 17 | public Guid UserId { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Command/CreateRoleCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Roles.Command 5 | { 6 | public class CreateRoleCommand : IRequest 7 | { 8 | public CreateRoleCommand(Guid organizationId, CreateRoleRequestDto roleRequest) 9 | { 10 | OrganizationId = organizationId; 11 | RoleRequestBody = roleRequest; 12 | } 13 | 14 | public Guid OrganizationId { get; } 15 | public CreateRoleRequestDto RoleRequestBody { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Command/DeleteRoleCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Roles.Command 10 | { 11 | public class DeleteRoleCommand : IRequest 12 | { 13 | public DeleteRoleCommand(Guid organizationId, Guid roleId) 14 | { 15 | OrganizationId = organizationId; 16 | RoleId = roleId; 17 | } 18 | 19 | public Guid OrganizationId { get; } 20 | public Guid RoleId { get; } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Command/UpdateRoleCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Roles.Command 10 | { 11 | public class UpdateRoleCommand : IRequest 12 | { 13 | public UpdateRoleCommand(Guid orgId, Guid roleId, UpdateRoleRequestDto uptRoleRequest) 14 | { 15 | OrgId = orgId; 16 | RoleId = roleId; 17 | UPTRoleRequest = uptRoleRequest; 18 | } 19 | 20 | public Guid OrgId { get; } 21 | public Guid RoleId { get; } 22 | public UpdateRoleRequestDto UPTRoleRequest { get; } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/AssignRoleDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Roles.Dto 9 | { 10 | public class AssignRoleDto 11 | { 12 | [JsonPropertyName("user_id")] 13 | public Guid Id { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/CreateRoleRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Roles.Dto 9 | { 10 | public class CreateRoleRequestDto 11 | { 12 | [JsonPropertyName("name")] 13 | public string Name { get; set; } 14 | [JsonPropertyName("description")] 15 | public string Description { get; set; } 16 | [JsonPropertyName("permissions")] 17 | public List Permissions { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/CreateRoleResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Roles.Dto 4 | { 5 | public class CreateRoleResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | [JsonPropertyName("data")] 10 | public RoleDetails Data { get; set; } 11 | [JsonPropertyName("error")] 12 | public string Error { get; set; } 13 | [JsonPropertyName("message")] 14 | public string Message { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/DeleteRoleResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Application.Features.Roles.Dto 8 | { 9 | public class DeleteRoleResponseDto 10 | { 11 | public int StatusCode { get; set; } 12 | public string Message { get; set; } 13 | public string Error { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/PermissionUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Application.Features.Roles.Dto 8 | { 9 | public class PermissionUpdateModel 10 | { 11 | public int Id { get; set; } 12 | public string Name { get; set; } 13 | public string Description { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/RoleDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Roles.Dto 4 | { 5 | public class RoleDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | 10 | [JsonPropertyName("name")] 11 | public string Name { get; set; } 12 | 13 | [JsonPropertyName("description")] 14 | public string Description { get; set; } 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/UpdateRoleRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Roles.Dto 9 | { 10 | public class UpdateRoleRequestDto 11 | { 12 | [JsonPropertyName("name")] 13 | public string Name { get; set; } 14 | [JsonPropertyName("description")] 15 | public string Description { get; set; } 16 | 17 | [JsonPropertyName("permissions")] 18 | public List Permissions { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Dto/UpdateRoleResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Features.Roles.Dto 9 | { 10 | public class UpdateRoleResponseDto 11 | { 12 | public int StatusCode { get; set; } 13 | [JsonPropertyName("role_id")] 14 | public string Id { get; set; } 15 | [JsonPropertyName("name")] 16 | public string Name { get; set; } 17 | [JsonPropertyName("description")] 18 | public string Description { get; set; } 19 | public string Message { get; set; } 20 | public string Error { get; set; } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Queries/GetRoleByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Roles.Queries 10 | { 11 | public class GetRoleByIdQuery : IRequest 12 | { 13 | public GetRoleByIdQuery(Guid id, Guid orgId) 14 | { 15 | RoleId = id; 16 | OrganizationId = orgId; 17 | } 18 | 19 | public Guid RoleId { get; } 20 | public Guid OrganizationId { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Queries/GetRolePermissionsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Roles.Queries 10 | { 11 | public class GetRolePermissionsQuery : IRequest> 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Roles/Queries/GetRolesQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using MediatR; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.Roles.Queries 10 | { 11 | public class GetRolesQuery : IRequest> 12 | { 13 | public GetRolesQuery(Guid organizationId) 14 | { 15 | OrganizationId = organizationId; 16 | } 17 | 18 | public Guid OrganizationId { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Squeeze/Commands/CreateSqueezeCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Squeeze.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Squeeze.Commands; 5 | 6 | public class CreateSqueezeCommand(CreateSqueezeRequestDto createSqueezeRequestDto) : IRequest 7 | { 8 | public CreateSqueezeRequestDto SqueezeBody { get; } = createSqueezeRequestDto; 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Squeeze/Dtos/CreateSqueezeRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Squeeze.Dtos; 4 | 5 | public class CreateSqueezeRequestDto 6 | { 7 | [JsonPropertyName("first_name")] 8 | public string FirstName { get; set; } 9 | 10 | [JsonPropertyName("last_name")] 11 | public string LastName { get; set; } 12 | 13 | [JsonPropertyName("email")] 14 | public string Email { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Squeeze/Dtos/CreateSqueezeResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Squeeze.Dtos; 4 | 5 | public class CreateSqueezeResponseDto 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | public SqueezeDto Data { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Squeeze/Dtos/SqueezeDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Squeeze.Dtos; 4 | 5 | public class SqueezeDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | 10 | [JsonPropertyName("first_name")] 11 | public string FirstName { get; set; } 12 | 13 | [JsonPropertyName("last_name")] 14 | public string LastName { get; set; } 15 | 16 | [JsonPropertyName("email")] 17 | public string Email { get; set; } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Squeeze/Mappers/SqueezeMapperProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Squeeze.Dtos; 2 | 3 | namespace Hng.Application.Features.Squeeze.Mappers; 4 | 5 | public class SqueezeMapperProfile : AutoMapper.Profile 6 | { 7 | public SqueezeMapperProfile() 8 | { 9 | CreateMap() 10 | .ReverseMap(); 11 | CreateMap(); 12 | CreateMap(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Commands/ActivateSubscriptionCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Subscriptions.Dtos; 2 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 3 | using MediatR; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Hng.Application.Features.Subscriptions.Commands 11 | { 12 | public class ActivateSubscriptionCommand : IRequest 13 | { 14 | public ActivateSubscriptionCommand(Guid subscriptionId) 15 | { 16 | SubscriptionId = subscriptionId; 17 | } 18 | 19 | public Guid SubscriptionId { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Dtos/Requests/GetSubscriptionByOrganizationIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Organisations.Dtos; 2 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 3 | using MediatR; 4 | 5 | 6 | namespace Hng.Application.Features.Subscriptions.Dtos.Requests 7 | { 8 | public class GetSubscriptionByOrganizationIdQuery : IRequest 9 | { 10 | public Guid OrganizationId { get; set; } 11 | 12 | public GetSubscriptionByOrganizationIdQuery(Guid organizationId) 13 | { 14 | OrganizationId = organizationId; 15 | } 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Dtos/Requests/GetSubscriptionByUserIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.Subscriptions.Dtos.Requests 5 | { 6 | public class GetSubscriptionByUserIdQuery : IRequest 7 | { 8 | public Guid UserId { get; set; } 9 | 10 | public GetSubscriptionByUserIdQuery(Guid userId) 11 | { 12 | UserId = userId; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Dtos/Requests/GetSubscriptionsQueryParameters.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Subscriptions.Dtos.Requests 4 | { 5 | public class GetSubscriptionsQueryParameters 6 | { 7 | [JsonPropertyName("page_size")] 8 | public int PageSize { get; set; } 9 | [JsonPropertyName("page_number")] 10 | public int PageNumber { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Dtos/Requests/SubscribeFreePlan.cs: -------------------------------------------------------------------------------- 1 | using CSharpFunctionalExtensions; 2 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Subscriptions.Dtos.Requests 6 | { 7 | public record SubscribeFreePlan : IRequest> 8 | { 9 | public string UserId { get; set; } 10 | 11 | public string OrganizationId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Dtos/Responses/SubscriptionDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Application.Features.Subscriptions.Dtos.Responses 8 | { 9 | public class SubscriptionDto 10 | { 11 | public Guid Id { get; set; } 12 | public Guid UserId { get; set; } 13 | public Guid OrganizationId { get; set; } 14 | public Guid TransactionId { get; set; } 15 | public string Plan { get; set; } 16 | public string Frequency { get; set; } 17 | public bool IsActive { get; set; } 18 | public decimal Amount { get; set; } 19 | public DateTime? StartDate { get; set; } 20 | public DateTime? ExpiryDate { get; set; } 21 | public DateTime CreatedAt { get; set; } 22 | public DateTime? UpdatedAt { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Mappers/SubscriptionMappingProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.Subscriptions.Mappers 5 | { 6 | public class SubscriptionMappingProfile : AutoMapper.Profile 7 | { 8 | public SubscriptionMappingProfile() 9 | { 10 | CreateMap(); 11 | CreateMap(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Subscriptions/Queries/GetSubscriptionsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Subscriptions.Dtos.Requests; 2 | using Hng.Application.Features.Subscriptions.Dtos.Responses; 3 | using Hng.Application.Shared.Dtos; 4 | using MediatR; 5 | 6 | namespace Hng.Application.Features.Subscriptions.Queries 7 | { 8 | public class GetSubscriptionsQuery : IRequest> 9 | { 10 | public GetSubscriptionsQuery(GetSubscriptionsQueryParameters parameters) 11 | { 12 | subscriptionsQueryParameters = parameters; 13 | } 14 | 15 | public GetSubscriptionsQueryParameters subscriptionsQueryParameters { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/SuperAdmin/Dto/UserDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.SuperAdmin.Dto 4 | { 5 | public class UserSuperDto 6 | { 7 | [JsonPropertyName("id")] 8 | public Guid Id { get; set; } 9 | [JsonPropertyName("first_name")] 10 | public string FirstName { get; set; } 11 | [JsonPropertyName("last_name")] 12 | public string LastName { get; set; } 13 | [JsonPropertyName("avatar_url")] 14 | public string AvatarUrl { get; set; } 15 | [JsonPropertyName("email")] 16 | public string Email { get; set; } 17 | [JsonPropertyName("created_on")] 18 | public DateTime CreatedAt { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/SuperAdmin/Dto/UsersQueryParameters.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Shared.Dtos; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.SuperAdmin.Dto 5 | { 6 | public class UsersQueryParameters : BaseQueryParameters 7 | { 8 | [JsonPropertyName("email")] 9 | public string Email { get; set; } 10 | [JsonPropertyName("first_name")] 11 | public string Firstname { get; set; } 12 | [JsonPropertyName("last_name")] 13 | public string Lastname { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/SuperAdmin/Mappers/AdminUsersMappingProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.SuperAdmin.Dto; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.SuperAdmin.Mappers 5 | { 6 | public class AdminUsersMappingProfile : AutoMapper.Profile 7 | { 8 | public AdminUsersMappingProfile() 9 | { 10 | CreateMap().ReverseMap(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/SuperAdmin/Queries/GetUsersBySearchQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.SuperAdmin.Dto; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.SuperAdmin.Queries 6 | { 7 | public class GetUsersBySearchQuery : IRequest> 8 | { 9 | public GetUsersBySearchQuery(UsersQueryParameters parameters) 10 | { 11 | usersQueryParameters = parameters; 12 | } 13 | 14 | public UsersQueryParameters usersQueryParameters { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/Timezones/Commands/CreateTimezoneCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Timezones.Dtos; 2 | using MediatR; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Hng.Application.Features.Timezones.Commands 6 | { 7 | public class CreateTimezoneCommand : IRequest 8 | { 9 | [JsonPropertyName("timezone")] 10 | public string Timezone { get; set; } 11 | 12 | [JsonPropertyName("gmt_offset")] 13 | public string GmtOffset { get; set; } 14 | 15 | [JsonPropertyName("description")] 16 | public string Description { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Timezones/Commands/UpdateTimezoneCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Timezones.Dtos; 2 | using MediatR; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Hng.Application.Features.Timezones.Commands 6 | { 7 | public class UpdateTimezoneCommand : IRequest 8 | { 9 | public Guid Id { get; set; } 10 | [JsonPropertyName("timezone")] 11 | public string Timezone { get; set; } 12 | 13 | [JsonPropertyName("gmt_offset")] 14 | public string GmtOffset { get; set; } 15 | 16 | [JsonPropertyName("description")] 17 | public string Description { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Timezones/Dtos/TimezoneDto.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Hng.Application.Features.Timezones.Dtos 4 | { 5 | public class TimezoneDto 6 | { 7 | [JsonProperty("id")] 8 | public Guid Id { get; set; } 9 | 10 | [JsonProperty("timezone")] 11 | public string Timezone { get; set; } 12 | 13 | [JsonProperty("gmt_offset")] 14 | public string GmtOffset { get; set; } 15 | 16 | [JsonProperty("description")] 17 | public string Description { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Timezones/Dtos/TimezoneResponseDto.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Hng.Application.Features.Timezones.Dtos 4 | { 5 | public class TimezoneResponseDto 6 | { 7 | [JsonProperty("timezone")] 8 | public TimezoneDto Timezone { get; set; } 9 | 10 | [JsonProperty("status_code")] 11 | public int StatusCode { get; set; } 12 | 13 | [JsonProperty("message")] 14 | public string Message { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Timezones/Dtos/UpdateTimezoneDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.Timezones.Dtos 4 | { 5 | public class UpdateTimezoneDto 6 | { 7 | [JsonPropertyName("timezone")] 8 | public string Timezone { get; set; } 9 | 10 | [JsonPropertyName("gmt_offset")] 11 | public string GmtOffset { get; set; } 12 | 13 | [JsonPropertyName("description")] 14 | public string Description { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/Timezones/Queries/GetAllTimezonesQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Timezones.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.Timezones.Queries 6 | { 7 | public class GetAllTimezonesQuery : IRequest>> 8 | { 9 | public int PageNumber { get; set; } 10 | public int PageSize { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Commands/FacebookLoginCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using Hng.Application.Shared.Dtos; 3 | using MediatR; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Hng.Application.Features.UserManagement.Commands 11 | { 12 | public class FacebookLoginCommand : IRequest> 13 | { 14 | public string FacebookToken { get; } 15 | 16 | public FacebookLoginCommand(string facebookToken) 17 | { 18 | FacebookToken = facebookToken; 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Commands/GoogleLoginCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using MediatR; 3 | 4 | 5 | namespace Hng.Application.Features.UserManagement.Commands 6 | { 7 | public class GoogleLoginCommand : IRequest> 8 | { 9 | public string IdToken { get; } 10 | 11 | public GoogleLoginCommand(string idToken) 12 | { 13 | IdToken = idToken; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Commands/SwitchOrganisationCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.UserManagement.Commands; 5 | 6 | public class SwitchOrganisationCommand : IRequest 7 | { 8 | public Guid OrganisationId { get; set; } 9 | public bool IsActive { get; set; } 10 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Commands/UserRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Application.Features.UserManagement.Commands 8 | { 9 | class UserRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Commands/UserSignUpCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.UserManagement.Commands 5 | { 6 | public class UserSignUpCommand : IRequest 7 | { 8 | public UserSignUpCommand(UserSignUpDto signUpDto) 9 | { 10 | SignUpBody = signUpDto; 11 | } 12 | 13 | public UserSignUpDto SignUpBody { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/FacebookLoginRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.Json.Serialization; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Application.Features.UserManagement.Dtos 10 | { 11 | public class FacebookLoginRequestDto 12 | { 13 | [Required] 14 | [JsonPropertyName("access_token")] 15 | public string AccessToken { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/GoogleLoginRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Application.Features.UserManagement.Dtos 5 | { 6 | public class GoogleLoginRequestDto 7 | { 8 | [Required] 9 | [JsonPropertyName("id_token")] 10 | public string IdToken { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/OrganisationDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.UserManagement.Dtos 4 | { 5 | public class OrganisationDto 6 | { 7 | [JsonPropertyName("organisation_id")] 8 | public Guid Id { get; set; } 9 | [JsonPropertyName("name")] 10 | public string Name { get; set; } 11 | [JsonPropertyName("role")] 12 | public string Role { get; set; } 13 | [JsonPropertyName("is_owner")] 14 | public bool IsOwner { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/SwitchOrganisationRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Hng.Application.Features.UserManagement.Dtos; 4 | 5 | public class SwitchOrganisationRequestDto 6 | { 7 | [Required] 8 | public bool IsActive { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/SwitchOrganisationResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Hng.Application.Features.Organisations.Dtos; 3 | 4 | namespace Hng.Application.Features.UserManagement.Dtos; 5 | 6 | public class SwitchOrganisationResponseDto 7 | { 8 | [JsonPropertyName("message")] 9 | public string Message { get; init; } 10 | 11 | [JsonPropertyName("status_code")] 12 | public int StatusCode { get; init; } 13 | 14 | [JsonPropertyName("data")] 15 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 16 | public OrganizationDto OrganisationDto { get; init; } 17 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/UserLoginRequestDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.UserManagement.Dtos 4 | { 5 | public class UserLoginRequestDto 6 | { 7 | [JsonPropertyName("email")] 8 | public string Email { get; set; } 9 | [JsonPropertyName("password")] 10 | public string Password { get; set; } 11 | public string Status { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/UserLoginResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.UserManagement.Dtos 4 | { 5 | public class UserLoginResponseDto 6 | { 7 | [JsonPropertyName("message")] 8 | public string Message { get; set; } 9 | [JsonPropertyName("data")] 10 | public T Data { get; set; } 11 | [JsonPropertyName("access_token")] 12 | public string AccessToken { get; set; } 13 | [JsonPropertyName("status_code")] 14 | public int StatusCode { get; set; } = 200; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Dtos/UserResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Features.UserManagement.Dtos 4 | { 5 | public class UserResponseDto 6 | { 7 | [JsonPropertyName("id")] 8 | public string Id { get; set; } 9 | 10 | [JsonPropertyName("first_name")] 11 | public string FirstName { get; set; } 12 | 13 | [JsonPropertyName("last_name")] 14 | public string LastName { get; set; } 15 | 16 | [JsonPropertyName("avatar_url")] 17 | public string AvatarUrl { get; set; } 18 | [JsonPropertyName("email")] 19 | public string Email { get; set; } 20 | 21 | [JsonPropertyName("created_at")] 22 | public DateTime CreatedAt { get; set; } 23 | [JsonPropertyName("is_superadmin")] 24 | public bool IsSuperAdmin { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Queries/GetLoggedInUserDetailsQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.UserManagement.Queries 5 | { 6 | public class GetLoggedInUserDetailsQuery : IRequest 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Queries/GetUserByIdQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.UserManagement.Queries 5 | { 6 | public class GetUserByIdQuery : IRequest 7 | { 8 | public GetUserByIdQuery(Guid id) 9 | { 10 | UserId = id; 11 | } 12 | 13 | public Guid UserId { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/UserManagement/Queries/GetUsersQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Hng.Application.Features.UserManagement.Dtos; 6 | using MediatR; 7 | 8 | namespace Hng.Application.Features.UserManagement.Queries 9 | { 10 | public class GetUsersQuery : IRequest> 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/WaitLists/Commands/CreateWaitlistCommand.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.WaitLists.Dtos; 2 | using Hng.Domain.Entities; 3 | using MediatR; 4 | 5 | namespace Hng.Application.Features.WaitLists.Commands 6 | { 7 | public class CreateWaitlistCommand : IRequest 8 | { 9 | public CreateWaitlistCommand(WaitListDto createWaitlist) 10 | { 11 | WaitlistEntry = createWaitlist; 12 | } 13 | public WaitListDto WaitlistEntry { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Hng.Application/Features/WaitLists/Commands/DeleteWaitlistByIdCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.WaitLists.Commands 5 | { 6 | public class DeleteWaitlistByIdCommand : IRequest 7 | { 8 | public DeleteWaitlistByIdCommand(Guid id) 9 | { 10 | WaitListId = id; 11 | } 12 | 13 | public Guid WaitListId { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/WaitLists/Dtos/WaitListDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Hng.Application.Features.WaitLists.Dtos 4 | { 5 | public class WaitListDto 6 | { 7 | [Required] 8 | public string Name { get; set; } 9 | 10 | [Required] 11 | [EmailAddress] 12 | public string Email { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/WaitLists/Mappers/WaitListMappingProfile.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.WaitLists.Dtos; 2 | using Hng.Domain.Entities; 3 | 4 | namespace Hng.Application.Features.WaitLists.Mappers 5 | { 6 | internal class WaitListMappingProfile : AutoMapper.Profile 7 | { 8 | public WaitListMappingProfile() 9 | { 10 | CreateMap().ReverseMap(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Application/Features/WaitLists/Queries/GetAllWaitlistQuery.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using MediatR; 3 | 4 | namespace Hng.Application.Features.WaitLists.Queries 5 | { 6 | public class GetAllWaitlistQuery : IRequest> 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/BaseQueryParameters.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Shared.Dtos 4 | { 5 | public class BaseQueryParameters 6 | { 7 | [JsonPropertyName("limit")] 8 | public int Limit { get; set; } = 10; 9 | [JsonPropertyName("offset")] 10 | public int Offset { get; set; } = 1; 11 | } 12 | } -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/BaseResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Shared.Dtos 4 | { 5 | public class BaseResponseDto 6 | { 7 | [JsonPropertyName("data")] 8 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] 9 | [JsonPropertyOrder(3)] 10 | public T Data { get; set; } 11 | [JsonPropertyName("message")] 12 | [JsonPropertyOrder(2)] 13 | public string Message { get; set; } = "Request completed successfully."; 14 | [JsonPropertyName("status_code")] 15 | [JsonPropertyOrder(1)] 16 | public int StatusCode { get; set; } = 200; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/ControllerErrorResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Shared.Dtos; 4 | 5 | //useful for annotating methods for swagger 6 | public class ControllerErrorResponse 7 | { 8 | 9 | [JsonPropertyName("status_code")] 10 | public int StatusCode { get; set; } 11 | 12 | [JsonPropertyName("message")] 13 | public List Errors { get; set; } 14 | 15 | [JsonPropertyName("data")] 16 | public EmptyDataResponse Data { get; set; } 17 | } 18 | 19 | public record Error 20 | { 21 | [JsonPropertyName("field")] 22 | public string Field { get; init; } 23 | 24 | [JsonPropertyName("error_message")] 25 | public string ErrorMessage { get; init; } 26 | } 27 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/ControllerResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Shared.Dtos; 4 | 5 | //useful for annotating methods for swagger 6 | public class ControllerResponse 7 | { 8 | 9 | [JsonPropertyName("status_code")] 10 | public int StatusCode { get; set; } 11 | 12 | [JsonPropertyName("message")] 13 | public string Message { get; set; } 14 | 15 | [JsonPropertyName("data")] 16 | public T Data { get; set; } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/EmptyDataResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Shared; 2 | 3 | public class EmptyDataResponse 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/FailureResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Shared.Dtos 9 | { 10 | public class FailureResponseDto 11 | { 12 | [JsonPropertyName("data")] 13 | public T Data { get; set; } 14 | [JsonPropertyName("error")] 15 | public string Error { get; set; } 16 | [JsonPropertyName("message")] 17 | public string Message { get; set; } = "Request failed."; 18 | [JsonPropertyName("status_code")] 19 | public int StatusCode { get; set; } = 400; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/PagedListMetadataDto.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Shared.Dtos 2 | { 3 | public class PagedListMetadataDto 4 | { 5 | public int TotalPages { get; set; } 6 | public int CurrentPage { get; set; } 7 | public int PageSize { get; set; } 8 | public int TotalCount { get; set; } 9 | public bool HasPrevious => CurrentPage > 1; 10 | public bool? HasNext => CurrentPage < TotalPages; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/PaginatedResponseDto.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Shared.Dtos 2 | { 3 | public class PaginatedResponseDto 4 | { 5 | public string Message { get; set; } = "Request completed successfully."; 6 | public PagedListMetadataDto Metadata { get; set; } 7 | public T Data { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/StatusCodeResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Application.Shared.Dtos 4 | { 5 | public class StatusCodeResponse 6 | { 7 | [JsonPropertyName("status_code")] 8 | public int StatusCode { get; set; } 9 | 10 | [JsonPropertyName("message")] 11 | public string Message { get; set; } 12 | 13 | [JsonPropertyName("data")] 14 | public object Data { get; set; } = new { }; 15 | //Workaround to prevent null data in the response when an object isn't passed 16 | } 17 | 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Hng.Application/Shared/Dtos/SuccessResponseDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json.Serialization; 6 | using System.Threading.Tasks; 7 | 8 | namespace Hng.Application.Shared.Dtos 9 | { 10 | public class SuccessResponseDto 11 | { 12 | [JsonPropertyName("data")] 13 | public T Data { get; set; } 14 | [JsonPropertyName("message")] 15 | public string Message { get; set; } = "Request completed successfully."; 16 | [JsonPropertyName("status_code")] 17 | public int StatusCode { get; set; } = 200; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Hng.Application/Utils/CloudinarySettings.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Utils 2 | { 3 | public class CloudinarySettings 4 | { 5 | public string CloudName { get; set; } 6 | 7 | public string ApiKey { get; set; } 8 | 9 | public string ApiSecret { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Hng.Application/Utils/GenerateTransactionReference.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Application.Utils 2 | { 3 | public class GenerateTransactionReference 4 | { 5 | public static string GenerateReference() => $"hng{DateTime.Now.Ticks}"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Hng.Application/Utils/LowerCaseNamingPolicy.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | 3 | namespace Hng.Application.Utils 4 | { 5 | public class LowerCaseNamingPolicy : JsonNamingPolicy 6 | { 7 | public override string ConvertName(string name) => name.ToLower(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/ApiStatus.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Enums; 2 | 3 | namespace Hng.Domain.Entities 4 | { 5 | public class ApiStatus : EntityBase 6 | { 7 | public string ApiGroup { get; set; } 8 | 9 | public ApiStatusType Status { get; set; } 10 | 11 | public long ResponseTime { get; set; } 12 | 13 | public string Details { get; set; } 14 | 15 | public DateTime LastChecked { get; set; } = DateTime.UtcNow; 16 | 17 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/BillingPlan.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Enums; 2 | 3 | namespace Hng.Domain.Entities 4 | { 5 | public class BillingPlan : EntityBase 6 | { 7 | public string Name { get; set; } 8 | 9 | public SubscriptionFrequency Frequency { get; set; } 10 | 11 | public bool IsActive { get; set; } 12 | 13 | public decimal Amount { get; set; } 14 | 15 | public string Description { get; set; } 16 | 17 | public DateTime CreatedAt { get; set; } 18 | 19 | public DateTime? UpdatedAt { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Blog.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Hng.Domain.Enums; 3 | 4 | namespace Hng.Domain.Entities; 5 | 6 | public class Blog : EntityBase 7 | { 8 | [Required] 9 | public string Title { get; set; } 10 | public string ImageUrl { get; set; } 11 | [Required] 12 | public string Content { get; set; } 13 | public DateTime PublishedDate { get; set; } 14 | public DateTime UpdatedDate { get; set; } 15 | public Guid AuthorId { get; set; } 16 | public User Author { get; set; } 17 | public BlogCategory Category { get; set; } 18 | public ICollection Comments { get; set; } 19 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Category.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class Category : EntityBase 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | public string Slug { get; set; } 8 | // public string ParentId { get; set; } 9 | public ICollection Products { get; set; } 10 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 11 | public DateTime? UpdatedAt { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Comment.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Hng.Domain.Entities; 4 | 5 | public class Comment : EntityBase 6 | { 7 | [Required] 8 | public string Content { get; set; } 9 | public Guid BlogId { get; set; } 10 | public Blog Blog { get; set; } 11 | public Guid AuthorId { get; set; } 12 | public User Author { get; set; } 13 | 14 | public DateTime CreatedAt { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/ContactUs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Domain.Entities 8 | { 9 | public class ContactUs : EntityBase 10 | { 11 | public string FullName { get; set; } 12 | public string Email { get; set; } 13 | public string PhoneNumber { get; set; } 14 | public string Message { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/EmailTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace Hng.Domain.Entities; 5 | 6 | [Index(nameof(Name), IsUnique = true)] 7 | public class EmailTemplate : EntityBase 8 | { 9 | [MaxLength(100)] 10 | public string Name { get; set; } 11 | public string Subject { get; set; } 12 | public string TemplateBody { get; set; } 13 | public Dictionary PlaceHolders { get; set; } = []; 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/EntityBase.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities; 2 | 3 | public class EntityBase 4 | { 5 | public Guid Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Faq.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class Faq : EntityBase 4 | { 5 | public string Question { get; set; } 6 | public string Answer { get; set; } 7 | public string Category { get; set; } 8 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 9 | public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; 10 | public string CreatedBy { get; set; } = "SuperAdmin"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/HelpCenterTopic.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class HelpCenterTopic : EntityBase 4 | { 5 | public string Title { get; set; } 6 | public string Content { get; set; } 7 | public string Author { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Job.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Enums; 2 | 3 | namespace Hng.Domain.Entities; 4 | 5 | public class Job : EntityBase 6 | { 7 | public string Title { get; set; } 8 | public string Description { get; set; } 9 | public string Location { get; set; } 10 | public double Salary { get; set; } 11 | public ExperienceLevel Level { get; set; } 12 | public string Company { get; set; } 13 | public DateTime DatePosted { get; set; } 14 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Language.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Hng.Domain.Entities 4 | { 5 | public class Language : EntityBase 6 | { 7 | [Required] 8 | public string Name { get; set; } 9 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 10 | public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; 11 | public ICollection Users { get; set; } = new List(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/LastLogin.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class LastLogin : EntityBase 4 | { 5 | public Guid UserId { get; set; } 6 | public User User { get; set; } 7 | public DateTime LoginTime { get; set; } = DateTime.UtcNow; 8 | public DateTime? LogoutTime { get; set; } 9 | public string IPAddress { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/NewsLetterSubscriber.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class NewsLetterSubscriber : EntityBase 4 | { 5 | public string Email { get; set; } 6 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 7 | public DateTime? LeftOn { get; set; } 8 | public bool IsDeleted { get; set; } = false; 9 | } 10 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Notification.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Domain.Entities 8 | { 9 | public class Notification : EntityBase 10 | { 11 | public Guid UserId { get; set; } 12 | public User User { get; set; } 13 | public bool IsRead { get; set; } = false; 14 | public string Message { get; set; } 15 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 16 | public DateTime? UpdatedAt { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/NotificationSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class NotificationSettings : EntityBase 4 | { 5 | public Guid UserId { get; set; } 6 | public User User { get; set; } 7 | public bool MobilePushNotifications { get; set; } 8 | public bool ActivityWorkspaceEmail { get; set; } 9 | public bool EmailNotifications { get; set; } 10 | public bool EmailDigests { get; set; } 11 | public bool AnnouncementsUpdateEmails { get; set; } 12 | public bool ActivityWorkspaceSlack { get; set; } 13 | public bool SlackNotifications { get; set; } 14 | public bool AnnouncementsUpdateSlack { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/OrganizationInvite.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Hng.Domain.Enums; 3 | using Microsoft.EntityFrameworkCore; 4 | 5 | namespace Hng.Domain.Entities; 6 | 7 | [Index(nameof(InviteCode))] 8 | public class OrganizationInvite : EntityBase 9 | { 10 | [Required] 11 | public Guid OrganizationId { get; set; } 12 | 13 | [Required] 14 | public string Email { get; set; } 15 | 16 | [Required] 17 | public OrganizationInviteStatus Status { get; set; } = OrganizationInviteStatus.Pending; 18 | 19 | [Required] 20 | public Guid InviteCode { get; set; } 21 | 22 | [Required] 23 | public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; 24 | 25 | [Required] 26 | public DateTimeOffset ExpiresAt { get; set; } = DateTimeOffset.UtcNow.AddDays(7); 27 | 28 | public DateTimeOffset AcceptedAt { get; set; } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities; 2 | public class Product : EntityBase 3 | { 4 | public string Name { get; set; } 5 | public string Description { get; set; } 6 | public string Category { get; set; } 7 | public decimal Price { get; set; } 8 | public bool Available { get; set; } 9 | public Guid UserId { get; set; } 10 | public User User { get; set; } 11 | public string Status { get; set; } = "In Stock"; 12 | public string ImageUrl { get; set; } 13 | public string Size { get; set; } 14 | public int Quantity { get; set; } 15 | public Guid OrganizationId { get; set; } 16 | public Organization Organization { get; set; } 17 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 18 | public DateTime? UpdatedAt { get; set; } 19 | public ICollection Transactions { get; set; } = new List(); 20 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Profile.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class Profile : EntityBase 4 | { 5 | public string FirstName { get; set; } 6 | public string LastName { get; set; } 7 | public string PhoneNumber { get; set; } 8 | public string AvatarUrl { get; set; } 9 | public Guid UserId { get; set; } 10 | public User User { get; set; } 11 | public string Username { get; set; } 12 | public string Pronoun { get; set; } 13 | public string JobTitle { get; set; } 14 | public string Bio { get; set; } 15 | public string Department { get; set; } 16 | public string FacebookLink { get; set; } 17 | public string TwitterLink { get; set; } 18 | public string LinkedinLink { get; set; } 19 | public string InstagramLink { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Role.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class Role : EntityBase 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | public bool IsActive { get; set; } 8 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 9 | public DateTime? UpdatedAt { get; set; } = null; 10 | public Guid OrganizationId { get; set; } 11 | public Organization Organisation { get; set; } 12 | public ICollection Permissions { get; set; } = []; 13 | public ICollection UsersRoles { get; set; } = []; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/RolePermission.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class RolePermission : EntityBase 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | public bool IsActive { get; set; } 8 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 9 | public DateTime? UpdatedAt { get; set; } = null; 10 | public ICollection Roles { get; set; } = []; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Squeeze.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Hng.Domain.Entities; 4 | 5 | public class Squeeze : EntityBase 6 | { 7 | [Required] 8 | public string FirstName { get; set; } 9 | 10 | [Required] 11 | public string LastName { get; set; } 12 | 13 | [EmailAddress] 14 | public string Email { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Timezone.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class Timezone : EntityBase 4 | { 5 | public string TimezoneValue { get; set; } 6 | public string GmtOffset { get; set; } 7 | public string Description { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/UserRole.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class UserRole : EntityBase 4 | { 5 | public Guid UserId { get; set; } 6 | public Guid RoleId { get; set; } 7 | public Guid OrganizationId { get; set; } 8 | 9 | public User User { get; set; } 10 | public Role Role { get; set; } 11 | public Organization Orgainzation { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Domain/Entities/Waitlist.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Entities 2 | { 3 | public class Waitlist : EntityBase 4 | { 5 | public string Name { get; set; } 6 | public string Email { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Hng.Domain/EntitiesConfigurations/ApiStatusConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Hng.Domain.Enums; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 6 | 7 | namespace Hng.Domain.EntitiesConfigurations 8 | { 9 | public class ApiStatusConfiguration : IEntityTypeConfiguration 10 | { 11 | public void Configure(EntityTypeBuilder builder) 12 | { 13 | builder 14 | .HasKey(i => i.Id); 15 | 16 | builder 17 | .Property(p => p.Status) 18 | .HasConversion(new EnumToStringConverter()); 19 | 20 | builder 21 | .Property(a => a.ApiGroup) 22 | .HasMaxLength(100); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Hng.Domain/EntitiesConfigurations/NewsLetterSubscriberConfig.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | 5 | namespace Hng.Domain.EntitiesConfigurations 6 | { 7 | public class NewsLetterSubscriberConfig : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(nl => nl.Id); 12 | builder.HasIndex(nl => nl.Email) 13 | .IsUnique(); 14 | builder.Property(nl => nl.Email) 15 | .HasMaxLength(150) 16 | .IsRequired(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Domain/EntitiesConfigurations/RoleConfig.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | 5 | namespace Hng.Domain.EntitiesConfigurations 6 | { 7 | public class RoleConfig : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(x => x.Id); 12 | builder.Property(x => x.Name) 13 | .HasMaxLength(250) 14 | .IsRequired(); 15 | builder.Property(x => x.Description); 16 | builder.Property(x => x.IsActive).IsRequired(); 17 | builder.Property(x => x.CreatedAt).IsRequired(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Domain/EntitiesConfigurations/RolePermissionConfig.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | 5 | namespace Hng.Domain.EntitiesConfigurations 6 | { 7 | public class RolePermissionConfig : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(x => x.Id); 12 | builder.Property(x => x.Name) 13 | .HasMaxLength(128) 14 | .IsRequired(); 15 | 16 | builder.Property(x => x.Description); 17 | builder.Property(x => x.CreatedAt).IsRequired(); 18 | 19 | builder.HasMany(rp => rp.Roles) 20 | .WithMany(r => r.Permissions); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Hng.Domain/EntitiesConfigurations/SubscriptionConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Enums; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 4 | using Microsoft.EntityFrameworkCore; 5 | using Hng.Domain.Entities; 6 | 7 | namespace Hng.Domain.EntitiesConfigurations 8 | { 9 | public class SubscriptionConfiguration : IEntityTypeConfiguration 10 | { 11 | public void Configure(EntityTypeBuilder builder) 12 | { 13 | builder.Property(p => p.Plan).HasConversion(new EnumToStringConverter()); 14 | builder.Property(p => p.Frequency).HasConversion(new EnumToStringConverter()); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/ApiStatusType.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace Hng.Domain.Enums 5 | { 6 | [JsonConverter(typeof(StringEnumConverter))] 7 | public enum ApiStatusType 8 | { 9 | Operational, 10 | Degraded, 11 | Down, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/BlogCategory.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Enums; 2 | 3 | public enum BlogCategory 4 | { 5 | Startup, 6 | Programming, 7 | Software, 8 | Data 9 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/ExperienceLevel.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Enums; 2 | 3 | public enum ExperienceLevel 4 | { 5 | Junior, 6 | Intermediate, 7 | Senior 8 | } -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/MessageStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Enums; 2 | 3 | public enum MessageStatus 4 | { 5 | Pending, 6 | Sent, 7 | Failed 8 | } 9 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/MessageType.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Enums; 2 | 3 | public enum MessageType 4 | { 5 | Email, 6 | SMS 7 | } 8 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/OrganizationInviteStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Enums; 2 | 3 | public enum OrganizationInviteStatus 4 | { 5 | Pending, 6 | Accepted, 7 | Expired 8 | } 9 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/PaystackResponseStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Domain.Enums 2 | { 3 | public enum PaystackResponseStatus 4 | { 5 | processed, 6 | resolved, 7 | archived, 8 | complete, 9 | active, 10 | otp, 11 | pending, 12 | failed, 13 | success, 14 | reversed 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/SubscriptionFrequency.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace Hng.Domain.Enums 5 | { 6 | [JsonConverter(typeof(StringEnumConverter))] 7 | public enum SubscriptionFrequency 8 | { 9 | Monthly, 10 | Quarterly, 11 | HalfYearly, 12 | Annually 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/SubscriptionPlan.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace Hng.Domain.Enums 5 | { 6 | [JsonConverter(typeof(StringEnumConverter))] 7 | public enum SubscriptionPlan 8 | { 9 | Free, 10 | Basic, 11 | Advanced, 12 | Premium 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/TransactionIntegrationPartners.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace Hng.Domain.Enums 5 | { 6 | [JsonConverter(typeof(StringEnumConverter))] 7 | public enum TransactionIntegrationPartners 8 | { 9 | Paystack, 10 | Stripe, 11 | Flutterwave 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/TransactionStatus.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace Hng.Domain.Enums 5 | { 6 | [JsonConverter(typeof(StringEnumConverter))] 7 | public enum TransactionStatus 8 | { 9 | Pending, 10 | Completed, 11 | Failed 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Hng.Domain/Enums/TransactionType.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace Hng.Domain.Enums 5 | { 6 | [JsonConverter(typeof(StringEnumConverter))] 7 | public enum TransactionType 8 | { 9 | product, 10 | subscription 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Hng.Graphql/ConfigureGraphql.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace Hng.Graphql 4 | { 5 | public static class ConfigureGraphql 6 | { 7 | public static IServiceCollection AddGraphql(this IServiceCollection services) 8 | { 9 | services.AddGraphQLServer() 10 | .AddQueryType() 11 | .AddMutationType() 12 | .AddAuthorization(); 13 | 14 | return services; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Mutations/Mutations.Comment.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Comments.Commands; 2 | using Hng.Application.Features.Comments.Dtos; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Mutations 10 | { 11 | [Authorize] 12 | public async Task CreateComment(Guid blogId, CreateCommentDto body, [FromServices] IMediator mediator) 13 | { 14 | var command = new CreateCommentCommand(body, blogId); 15 | return await mediator.Send(command); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Mutations/Mutations.EmailTemplate.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.EmailTemplates.Commands; 2 | using Hng.Application.Features.EmailTemplates.DTOs; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Mutations 10 | { 11 | [Authorize] 12 | public async Task CreateTemplate(CreateEmailTemplateDTO createEmailDTO, [FromServices] IMediator mediator) 13 | { 14 | var command = new CreateEmailTemplateCommand(createEmailDTO); 15 | return await mediator.Send(command); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Mutations/Mutations.NewsLetter.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.NewsLetterSubscription.Commands; 2 | using Hng.Application.Features.NewsLetterSubscription.Dtos; 3 | using MediatR; 4 | using Microsoft.AspNetCore.Mvc; 5 | 6 | namespace Hng.Graphql 7 | { 8 | public partial class Mutations 9 | { 10 | public async Task RegisterNewsLetterSubscriber(NewsLetterSubscriptionDto subscriber, [FromServices] IMediator mediator) 11 | { 12 | return await mediator.Send(new AddSubscriberCommand(subscriber)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Mutations/Mutations.NotificationSettings.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Commands; 2 | using Hng.Application.Features.Notifications.Dtos; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Mutations 10 | { 11 | /// 12 | /// Notification Settings - User notification settings 13 | /// 14 | [Authorize] 15 | public async Task CreateNotificationSettings([FromBody] CreateNotificationSettingsDto command, [FromServices] IMediator mediator) 16 | { 17 | { 18 | var createCommand = new CreateNotificationSettingsCommand(command); 19 | return await mediator.Send(createCommand); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.Admin.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.SuperAdmin.Dto; 2 | using Hng.Application.Features.SuperAdmin.Queries; 3 | using Hng.Application.Shared.Dtos; 4 | using HotChocolate.Authorization; 5 | using MediatR; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace Hng.Graphql 9 | { 10 | public partial class Queries 11 | { 12 | [Authorize] 13 | public async Task> GetUsersBySearch(UsersQueryParameters parameters, [FromServices] IMediator mediator) 14 | { 15 | var users = new GetUsersBySearchQuery(parameters); 16 | return await mediator.Send(users); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.Authentication.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.UserManagement.Dtos; 2 | using Hng.Application.Features.UserManagement.Queries; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Queries 10 | { 11 | [Authorize] 12 | public async Task GetLoggedInUsersDetails([FromServices] IMediator mediator) 13 | { 14 | var query = new GetLoggedInUserDetailsQuery(); 15 | return await mediator.Send(query); 16 | } 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.Blog.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Blogs.Dtos; 2 | using Hng.Application.Features.Blogs.Queries; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Queries 10 | { 11 | [Authorize] 12 | public async Task GetBlogById(Guid id, [FromServices] IMediator mediator) 13 | { 14 | var query = new GetBlogByIdQuery(id); 15 | return await mediator.Send(query); 16 | } 17 | 18 | [Authorize] 19 | public async Task> GetBlogs([FromServices] IMediator mediator) 20 | { 21 | var blogs = new GetBlogsQuery(); 22 | return await mediator.Send(blogs); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.Comment.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Comments.Dtos; 2 | using Hng.Application.Features.Comments.Queries; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Queries 10 | { 11 | [Authorize] 12 | public async Task> GetCommentsByBlogId(Guid blogId, [FromServices] IMediator mediator) 13 | { 14 | var query = new GetCommentsByBlogIdQuery(blogId); 15 | return await mediator.Send(query); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.ContactUs.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.ContactsUs.Dtos; 2 | using Hng.Application.Features.ContactsUs.Queries; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Queries 10 | { 11 | [Authorize] 12 | public async Task>> GetAllContactMessages([FromServices] IMediator mediator) 13 | { 14 | var query = new GetAllContactUsQuery(); 15 | return await mediator.Send(query); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.EmailTemplate.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.EmailTemplates.DTOs; 2 | using Hng.Application.Features.EmailTemplates.Queries; 3 | using Hng.Application.Shared.Dtos; 4 | using HotChocolate.Authorization; 5 | using MediatR; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace Hng.Graphql 9 | { 10 | public partial class Queries 11 | { 12 | [Authorize] 13 | public async Task>> GetAllTemplates(GetAllEmailTemplatesQuery query, [FromServices] IMediator mediator) 14 | { 15 | return await mediator.Send(query); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.Faq.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Faq.Dtos; 2 | using Hng.Application.Features.Faq.Queries; 3 | using MediatR; 4 | using Microsoft.AspNetCore.Mvc; 5 | 6 | namespace Hng.Graphql 7 | { 8 | public partial class Queries 9 | { 10 | public async Task> GetAllFaqs([FromServices] IMediator mediator) 11 | { 12 | var query = new GetAllFaqsQuery(); 13 | return await mediator.Send(query); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Features/Queries/Queries.NotificationSetting.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Notifications.Dtos; 2 | using Hng.Application.Features.Notifications.Queries; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Hng.Graphql 13 | { 14 | public partial class Queries 15 | { 16 | /// 17 | /// Get Notification Settings by User ID 18 | /// 19 | [Authorize] 20 | public async Task GetNotificationSettings(Guid user_id, [FromServices] IMediator mediator) 21 | { 22 | var query = new GetNotificationSettingsQuery(user_id); 23 | return await mediator.Send(query); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Hng.Graphql.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Hng.Graphql/Mutations.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Command; 2 | using Hng.Application.Features.Roles.Dto; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Mutations 10 | { 11 | 12 | 13 | [Authorize] 14 | public async Task CreateRoleInOrganisation(Guid orgId, CreateRoleRequestDto request, [FromServices] IMediator mediator) 15 | { 16 | CreateRoleCommand command = new CreateRoleCommand(orgId, request); 17 | return await mediator.Send(command); 18 | } 19 | 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /src/Hng.Graphql/Queries.cs: -------------------------------------------------------------------------------- 1 | using Hng.Application.Features.Roles.Dto; 2 | using Hng.Application.Features.Roles.Queries; 3 | using HotChocolate.Authorization; 4 | using MediatR; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Hng.Graphql 8 | { 9 | public partial class Queries 10 | { 11 | 12 | 13 | [Authorize] 14 | public async Task> GetRolesInOrganisation(Guid orgId, [FromServices] IMediator mediator) 15 | { 16 | var query = new GetRolesQuery(orgId); 17 | return await mediator.Send(query); 18 | } 19 | 20 | [Authorize] 21 | public async Task> GetAllPermissions([FromServices] IMediator mediator) 22 | { 23 | var query = new GetRolePermissionsQuery(); 24 | return await mediator.Send(query); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/EmailTemplates/TemplateDir.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.EmailTemplates; 2 | 3 | public record TemplateDir 4 | { 5 | public string Path { get; init; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Migrations/20240812055818_faqCategories.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Hng.Infrastructure.Migrations 6 | { 7 | /// 8 | public partial class faqCategories : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "category", 15 | table: "FAQ", 16 | type: "text", 17 | nullable: true); 18 | } 19 | 20 | /// 21 | protected override void Down(MigrationBuilder migrationBuilder) 22 | { 23 | migrationBuilder.DropColumn( 24 | name: "category", 25 | table: "FAQ"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Migrations/20240813081318_update.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Hng.Infrastructure.Migrations 6 | { 7 | /// 8 | public partial class update : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | 14 | } 15 | 16 | /// 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Migrations/20240816035339_IPAddressLastLogin.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Hng.Infrastructure.Migrations 6 | { 7 | /// 8 | public partial class IPAddressLastLogin : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "IPAddress", 15 | table: "LastLogins", 16 | type: "text", 17 | nullable: true); 18 | } 19 | 20 | /// 21 | protected override void Down(MigrationBuilder migrationBuilder) 22 | { 23 | migrationBuilder.DropColumn( 24 | name: "IPAddress", 25 | table: "LastLogins"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Migrations/20240831093552_added squeeze entity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Hng.Infrastructure.Migrations 6 | { 7 | /// 8 | public partial class addedsqueezeentity : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | 14 | } 15 | 16 | /// 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/GoogleAuthService.cs: -------------------------------------------------------------------------------- 1 | using Google.Apis.Auth; 2 | using Hng.Infrastructure.Services.Interfaces; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Hng.Infrastructure.Services 10 | { 11 | public class GoogleAuthService : IGoogleAuthService 12 | { 13 | public Task ValidateAsync(string idToken) 14 | { 15 | return GoogleJsonWebSignature.ValidateAsync(idToken); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IAuthenticationService.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Hng.Infrastructure.Services.Interfaces; 3 | 4 | public interface IAuthenticationService 5 | { 6 | Task GetCurrentUserAsync(); 7 | } -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IEmailService.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | 3 | namespace Hng.Infrastructure.Services.Interfaces; 4 | 5 | public interface IEmailService 6 | { 7 | 8 | public Task SendEmailMessage(Message message); 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IEmailTemplateService.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Services.Interfaces; 2 | 3 | public interface IEmailTemplateService 4 | { 5 | public Task GetOrganizationInviteTemplate(); 6 | 7 | public Task GetForgotPasswordEmailTemplate(); 8 | 9 | Task GetForgotPasswordMobileEmailTemplate(); 10 | } 11 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IFacebookAuthService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Hng.Infrastructure.Services.Interfaces 8 | { 9 | public interface IFacebookAuthService 10 | { 11 | Task ValidateAsync(string accessToken); 12 | } 13 | 14 | public class FacebookUser 15 | { 16 | public string Id { get; set; } 17 | public string Name { get; set; } 18 | public string Email { get; set; } 19 | public FacebookPicture Picture { get; set; } 20 | } 21 | 22 | public class FacebookPicture 23 | { 24 | public FacebookPictureData Data { get; set; } 25 | } 26 | 27 | public class FacebookPictureData 28 | { 29 | public string Url { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IGoogleAuthService.cs: -------------------------------------------------------------------------------- 1 | using Google.Apis.Auth; 2 | 3 | 4 | namespace Hng.Infrastructure.Services.Interfaces 5 | { 6 | public interface IGoogleAuthService 7 | { 8 | Task ValidateAsync(string idToken); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IMessageQueueService.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Hng.Infrastructure.Utilities.Results; 3 | 4 | namespace Hng.Infrastructure.Services.Interfaces; 5 | 6 | public interface IMessageQueueService 7 | { 8 | public Task> SendInviteEmailAsync( 9 | string inviterName, 10 | string inviteeEmail, 11 | string organizationName, 12 | DateTimeOffset expiryDate, 13 | string inviteLink); 14 | 15 | public Task> SendForgotPasswordEmailAsync( 16 | string firstname, 17 | string email, 18 | string companyname, 19 | string resetlink, 20 | string year); 21 | 22 | public Task> SendForgotPasswordEmailMobileAsync( 23 | string firstname, 24 | string email, 25 | string companyname, 26 | string resetCode, 27 | string year); 28 | } 29 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IOrganisationInviteService.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | using Hng.Infrastructure.Utilities; 3 | 4 | namespace Hng.Infrastructure.Services.Interfaces; 5 | 6 | public interface IOrganisationInviteService 7 | { 8 | public Task CreateInvite(Guid userId, Guid orgId, string email); 9 | 10 | public string GenerateInviteUrlFromToken(Guid inviteToken); 11 | } 12 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/IPasswordService.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Services.Interfaces 2 | { 3 | public interface IPasswordService 4 | { 5 | public (string passwordSalt, string hashedPassword) GeneratePasswordSaltAndHash(string plainPassword); 6 | public bool IsPasswordEqual(string plainPassword, string passwordSalt, string passwordHash); 7 | } 8 | } -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/ISmsService.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | 3 | namespace Hng.Infrastructure.Services.Interfaces; 4 | 5 | public interface ISmsService 6 | { 7 | public Task SendSMSMessage(Message message); 8 | } 9 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Services/Interfaces/ITokenService.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | 3 | namespace Hng.Infrastructure.Services.Interfaces 4 | { 5 | public interface ITokenService 6 | { 7 | public string GenerateJwt(User userData, int expireInMinutes = 0); 8 | 9 | public string GetCurrentUserEmail(); 10 | 11 | public string GetForgotPasswordToken(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/EmailQueue/Email.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities.EmailQueue; 2 | 3 | public record Email(string RecipientName, string RecipientMailAddress, string Subject, string Content); 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/EmailQueue/MessageToEmailExtension.cs: -------------------------------------------------------------------------------- 1 | using Hng.Domain.Entities; 2 | 3 | namespace Hng.Infrastructure.Utilities.EmailQueue; 4 | 5 | public static class MessageToEmailExtension 6 | { 7 | public static Email ToEmail(this Message message) 8 | { 9 | return new Email(message.RecipientName, message.RecipientContact, message.Subject, message.Content); 10 | } 11 | 12 | public static Message ToMessage(this Email email) 13 | { 14 | return Message.CreateEmail(email.RecipientMailAddress, email.Subject, email.Content, email.RecipientName); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/FrontendUrl.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Hng.Infrastructure.Utilities; 4 | 5 | public class FrontendUrl 6 | { 7 | [Required(ErrorMessage = "Frontend URL path is required")] 8 | [Url(ErrorMessage = "Invalid URL format")] 9 | public string Path { get; set; } 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/Jwt.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities 2 | { 3 | public class Jwt 4 | { 5 | public string SecretKey { get; set; } 6 | 7 | public int ExpireInMinute { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/Results/Error.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities.Results; 2 | 3 | public class Error(string Message) 4 | { 5 | public string Message { get; set; } = Message; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/Results/Result.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities.Results; 2 | 3 | public class Result 4 | { 5 | public bool IsSuccess { get; } 6 | 7 | public T Value { get; } 8 | 9 | public Error Error { get; } 10 | 11 | private Result(bool success, T data, Error error) 12 | { 13 | IsSuccess = success; 14 | Value = data; 15 | Error = error; 16 | } 17 | 18 | public static Result Success(T value) => new(true, value, null); 19 | public static Result Failure(Error error) => new(false, default, error); 20 | } 21 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/SmtpCredentials.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities; 2 | 3 | public class SmtpCredentials 4 | { 5 | public string Host { get; set; } 6 | public int Port { get; set; } 7 | public string Username { get; set; } 8 | public string Password { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/StringKeys/EmailConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities.StringKeys; 2 | 3 | public static class EmailConstants 4 | { 5 | public const string inviteEmailTemplate = "OrganisationInviteEmail.html"; 6 | public const string ForgotPasswordTemplate = "forgot-password.html"; 7 | public const string ForgotPasswordMobileTemplate = "forgot-password-mobile.html"; 8 | public const string senderMailboxName = "HNG Boilerplate"; 9 | public const string senderMailboxAddress = "boilerplate@hng.com"; 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/StringKeys/PaystackApiKeys.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities.StringKeys 2 | { 3 | public class PaystackApiKeys 4 | { 5 | public string Endpoint { get; set; } 6 | 7 | public string SecretKey { get; set; } 8 | 9 | public string PublicKey { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Hng.Infrastructure/Utilities/StringKeys/PaystackEventKeys.cs: -------------------------------------------------------------------------------- 1 | namespace Hng.Infrastructure.Utilities.StringKeys 2 | { 3 | public static class PaystackEventKeys 4 | { 5 | public static string charge_success = "charge.success"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Hng.Web/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md 26 | !**/.gitignore 27 | !.git/HEAD 28 | !.git/config 29 | !.git/packed-refs 30 | !.git/refs/heads/** -------------------------------------------------------------------------------- /src/Hng.Web/Hng.Web.http: -------------------------------------------------------------------------------- 1 | @Hng.Web_HostAddress = http://localhost:5288 2 | 3 | GET {{Hng.Web_HostAddress}}/weatherforecast/ 4 | Accept: application/json 5 | 6 | ### 7 | -------------------------------------------------------------------------------- /src/Hng.Web/ModelStateError/ModelError.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Hng.Web.ModelStateError; 4 | 5 | public record ModelError 6 | { 7 | [JsonPropertyName("field")] 8 | public string Field { get; init; } 9 | 10 | 11 | [JsonPropertyName("message")] 12 | public string Message { get; init; } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/Hng.Web/ModelStateError/ModelStateErrorResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Hng.Web.ModelStateError; 5 | 6 | public record ModelStateErrorResponse 7 | { 8 | [JsonPropertyName("status_code")] 9 | public int StatusCode { get; init; } = (int)HttpStatusCode.BadRequest; 10 | 11 | [JsonPropertyName("message")] 12 | public List Errors { get; init; } = []; 13 | 14 | [JsonPropertyName("data")] 15 | 16 | public object Data { get; } = new { }; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/Hng.Web/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | --------------------------------------------------------------------------------