public static Task SeedTestDataAsync(this MandarinDbContext mandarinDbContext)
 {
     using var connection = mandarinDbContext.GetConnection();
     connection.Open();
     mandarinDbContext.RunMigrations();
     return(Task.CompletedTask);
 }
        public static async Task CleanupTestDataAsync(this MandarinDbContext mandarinDbContext)
        {
            using var connection = mandarinDbContext.GetConnection();
            connection.Open();
            await connection.ExecuteAsync("DROP TABLE billing.commission");

            await connection.ExecuteAsync("DROP TABLE inventory.stockist_detail");

            await connection.ExecuteAsync("DROP TABLE inventory.stockist");

            await connection.ExecuteAsync("DROP TABLE inventory.fixed_commission_amount");

            await connection.ExecuteAsync("TRUNCATE TABLE public.schemaversions");
        }
Exemple #3
0
        /// <summary>
        /// Configures the HTTP Pipeline for Mandarin.
        ///
        /// <remarks>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </remarks>
        /// </summary>
        /// <param name="app">The application to be configured.</param>
        /// <param name="env">The application host environment.</param>
        /// <param name="mandarinDbContext">The application database context.</param>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, MandarinDbContext mandarinDbContext)
        {
            mandarinDbContext.RunMigrations();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebAssemblyDebugging();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.SafeUseAllElasticApm(this.configuration);
            app.UseSerilogRequestLogging();
            app.UseHttpsRedirection();
            app.UseBlazorFrameworkFiles();
            app.UseStaticFiles();

            app.AddLegacyRedirect("/static/logo-300.png", "/static/images/logo.png");
            app.AddLegacyRedirect("/static/Century-Schoolbook-Std-Regular.otf", "/static/fonts/Century-Schoolbook-Std-Regular.otf");

            app.UseRouting();

            app.UseGrpcWeb(new GrpcWebOptions {
                DefaultEnabled = true
            });
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGrpcService <CommissionsGrpcService>();
                endpoints.MapGrpcService <EmailGrpcService>();
                endpoints.MapGrpcService <FixedCommissionsGrpcService>();
                endpoints.MapGrpcService <ProductsGrpcService>();
                endpoints.MapGrpcService <StockistsGrpcService>();
                endpoints.MapFallbackToFile("index.html");
            });
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StockistRepository"/> class.
 /// </summary>
 /// <param name="mandarinDbContext">The application database context.</param>
 /// <param name="mapper">The mapper to translate between different object types.</param>
 /// <param name="logger">The application logger.</param>
 public StockistRepository(MandarinDbContext mandarinDbContext, IMapper mapper, ILogger <StockistRepository> logger)
     : base(mandarinDbContext, mapper, logger)
 {
     this.logger = logger;
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedCommissionAmountRepository"/> class.
 /// </summary>
 /// <param name="mandarinDbContext">The application database context.</param>
 /// <param name="mapper">The mapper to translate between different object types.</param>
 /// <param name="logger">The application logger.</param>
 public FixedCommissionAmountRepository(MandarinDbContext mandarinDbContext, IMapper mapper, ILogger <FixedCommissionAmountRepository> logger)
     : base(mandarinDbContext, mapper, logger)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseRepositoryBase{TDomain, TRecord}"/> class.
 /// </summary>
 /// <param name="mandarinDbContext">The application database context.</param>
 /// <param name="mapper">The mapper to translate between different object types.</param>
 /// <param name="logger">The application logger.</param>
 protected DatabaseRepositoryBase(MandarinDbContext mandarinDbContext, IMapper mapper, ILogger <DatabaseRepositoryBase <TDomain, TRecord> > logger)
 {
     this.mandarinDbContext = mandarinDbContext;
     this.mapper            = mapper;
     this.logger            = logger;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommissionRepository"/> class.
 /// </summary>
 /// <param name="mandarinDbContext">The application database context.</param>
 /// <param name="mapper">The mapper to translate between different object types.</param>
 /// <param name="logger">The application logger.</param>
 public CommissionRepository(MandarinDbContext mandarinDbContext, IMapper mapper, ILogger <CommissionRepository> logger)
     : base(mandarinDbContext, mapper, logger)
 {
 }