Added MidrandShop feature and spl;it extensions and healthchecks
continuous-integration/drone/pr Build is failing
continuous-integration/drone/pr Build is failing
This commit is contained in:
@@ -4,7 +4,10 @@ using LiteCharms.Features.Email.Configuration;
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class Email
|
||||
{
|
||||
{
|
||||
public const string ShopEmailFromName = "Khongisa Shop";
|
||||
public const string ShopEmailFromAddress = "shop@litecharms.co.za";
|
||||
|
||||
public static IServiceCollection AddEmailServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.Configure<SmtpSettings>(configuration.GetSection("Email"));
|
||||
|
||||
@@ -1,19 +1,34 @@
|
||||
using LiteCharms.Features.HealthChecks;
|
||||
using static LiteCharms.Features.Extensions.Postgres;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class HealthChecks
|
||||
{
|
||||
public static IServiceCollection AddQuartzHealtchCheck(this IServiceCollection services)
|
||||
public static IServiceCollection AddShopQuartzHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<QuartzHealthCheck>("Quartz");
|
||||
services.AddHealthChecks().AddCheck<ShopQuartzHealthCheck>("ShopQuartz");
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddPostgresHealtchCheck(this IServiceCollection services)
|
||||
public static IServiceCollection AddMidrandShopQuartzHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<PostgresHealthCheck>("PostgreSQL");
|
||||
services.AddHealthChecks().AddCheck<MidrandShopQuartzHealthCheck>("MidrandShopQuartz");
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddShopPostgresHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<PostgresShopHealthCheck>(ShopDbConfigName);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddMidrandShopPostgresHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<PostgresMidrandShopHealthCheck>(MidrandShopDbConfigName);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
using LiteCharms.Features.Shop.Postgres;
|
||||
using LiteCharms.Features.MidrandShop.Postgres;
|
||||
using LiteCharms.Features.Shop.Postgres;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class Postgres
|
||||
{
|
||||
public const string MidrandShopDbConfigName = "PostgresMidrandShop";
|
||||
public const string ShopDbConfigName = "PostgresShop";
|
||||
public const string SchedulerDbConfigName = "PostgresScheduler";
|
||||
|
||||
public static IServiceCollection AddShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddPooledDbContextFactory<ShopDbContext>(options =>
|
||||
options.UseNpgsql(configuration.GetConnectionString("PostgresShop")));
|
||||
options.UseNpgsql(configuration.GetConnectionString(ShopDbConfigName)));
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddMidrandShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddPooledDbContextFactory<MidrandShopDbContext>(options =>
|
||||
options.UseNpgsql(configuration.GetConnectionString(MidrandShopDbConfigName)));
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
using LiteCharms.Features.Quartz;
|
||||
using LiteCharms.Features.Quartz.Abstractions;
|
||||
using static LiteCharms.Features.Extensions.Postgres;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class Quartz
|
||||
{
|
||||
private const string databaseConfigName = "PostgresScheduler";
|
||||
public const string ShopSchedulerName = "shop";
|
||||
public const string MidrandShopSchedulerName = "midrandshop";
|
||||
|
||||
public static IServiceCollection AddQuartzSchedulerClient(this IServiceCollection services, string schedulerName, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString(databaseConfigName);
|
||||
var connectionString = configuration.GetConnectionString(SchedulerDbConfigName);
|
||||
|
||||
services.ConfigureCommon();
|
||||
|
||||
@@ -44,7 +46,7 @@ public static class Quartz
|
||||
|
||||
public static IServiceCollection AddQuartzScheduler(this IServiceCollection services, string schedulerName, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString(databaseConfigName);
|
||||
var connectionString = configuration.GetConnectionString(SchedulerDbConfigName);
|
||||
|
||||
services.ConfigureCommon();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user