Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5efdde37c | |||
| 87da491ed6 | |||
| 1592d5dc8f | |||
| 08a64d1578 | |||
| f67f5eaf53 | |||
| 50a8a59d92 | |||
| 70c6e0bfbc | |||
| b70d9559b0 | |||
| 032b9e1818 | |||
| 424c1c6f8c | |||
| 81d5e8f07c | |||
| 7d5e9a18d8 | |||
| 20a53942b5 | |||
| 9edb2aa4aa | |||
| 6ed023f2cf | |||
| 2c9f5a846c | |||
| 41f7c05be3 | |||
| 1a03355e84 | |||
| 7743c3178e | |||
| ab3d8e6e9a | |||
| db4c348288 | |||
| 6683234642 | |||
| 6ddbb9479a | |||
| 6c7349a0f8 | |||
| e97fd6cd3f | |||
| 184c7c252a | |||
| bfe8c458d6 | |||
| e6e0475db1 | |||
| 5090c60797 | |||
| 9432252e15 | |||
| 47111a1a3a | |||
| 6eb3d50375 | |||
| 4deb732804 | |||
| 20d9387d0b | |||
| 9f6d0ccaa0 | |||
| 1acbc4d213 | |||
| 8c99668fac | |||
| ad44f46204 | |||
| 49d999c1e3 | |||
| 9ed4777a18 | |||
| 0cf44f68cc | |||
| 41ed5a4288 | |||
| bbcba5e06c | |||
| 502cc326dd | |||
| 4675d4c5fc | |||
| f80bb2fff9 | |||
| 6767906b0d | |||
| a344af4498 |
+5
-1
@@ -19,6 +19,10 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- dotnet pack LiteCharms.Features/LiteCharms.Features.csproj -c Release -p:PackageVersion=$VERSION -o dist/
|
- dotnet pack LiteCharms.Features/LiteCharms.Features.csproj -c Release -p:PackageVersion=$VERSION -o dist/
|
||||||
- dotnet nuget push dist/LiteCharms.Features.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL
|
- dotnet nuget push dist/LiteCharms.Features.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL
|
||||||
|
- dotnet pack LiteCharms.Features.TechShop/LiteCharms.Features.TechShop.csproj -c Release -p:PackageVersion=$VERSION -o dist/
|
||||||
|
- dotnet nuget push dist/LiteCharms.Features.TechShop.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL
|
||||||
|
- dotnet pack LiteCharms.Features.MidrandBooks/LiteCharms.Features.MidrandBooks.csproj -c Release -p:PackageVersion=$VERSION -o dist/
|
||||||
|
- dotnet nuget push dist/LiteCharms.Features.MidrandBooks.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL
|
||||||
|
|
||||||
- name: gitea-tag-release
|
- name: gitea-tag-release
|
||||||
image: alpine/git
|
image: alpine/git
|
||||||
@@ -41,7 +45,7 @@ steps:
|
|||||||
\"tag_name\": \"$VERSION\",
|
\"tag_name\": \"$VERSION\",
|
||||||
\"target_commitish\": \"${DRONE_COMMIT_SHA}\",
|
\"target_commitish\": \"${DRONE_COMMIT_SHA}\",
|
||||||
\"name\": \"Library Suite $VERSION\",
|
\"name\": \"Library Suite $VERSION\",
|
||||||
\"body\": \"### Published NuGet Packages\nAll packages versioned as **$VERSION**:\n* LiteCharms.Features\n\n[View in Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\",
|
\"body\": \"### Published NuGet Packages\nAll packages versioned as **$VERSION**:\n* LiteCharms.Features\n* LiteCharms.Features.TechShop\n* LiteCharms.Features.MidrandBooks\n\n[View in Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\",
|
||||||
\"draft\": false,
|
\"draft\": false,
|
||||||
\"prerelease\": false
|
\"prerelease\": false
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using LiteCharms.Features.Extensions;
|
||||||
|
using LiteCharms.Features.MidrandBooks.Extensions;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.MidrandBooks.Tests;
|
||||||
|
|
||||||
|
public class Fixture : IDisposable
|
||||||
|
{
|
||||||
|
public IConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
|
public IServiceProvider Services { get; set; }
|
||||||
|
|
||||||
|
public IMediator Mediator { get; set; }
|
||||||
|
|
||||||
|
public Fixture()
|
||||||
|
{
|
||||||
|
Configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddUserSecrets<Fixture>()
|
||||||
|
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: true)
|
||||||
|
.AddEnvironmentVariables()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Services = new ServiceCollection()
|
||||||
|
.AddMediator()
|
||||||
|
.AddLogging()
|
||||||
|
//.AddMidrandShopServices()
|
||||||
|
.AddEmailServiceBus()
|
||||||
|
.AddGarageS3(Configuration)
|
||||||
|
.AddMidrandShopDatabase(Configuration)
|
||||||
|
.AddEmailServices(Configuration)
|
||||||
|
.AddSingleton(Configuration)
|
||||||
|
.BuildServiceProvider();
|
||||||
|
|
||||||
|
Mediator = Services.GetRequiredService<IMediator>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<UserSecretsId>b205af96-ceef-44e1-851c-458c9fd1c437</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="10.0.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Mediator.SourceGenerator" Version="3.0.2">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
|
||||||
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Mediator" />
|
||||||
|
<Using Include="Xunit.Abstractions" />
|
||||||
|
<Using Include="Microsoft.Extensions.DependencyInjection" />
|
||||||
|
<Using Include="Microsoft.Extensions.Configuration" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LiteCharms.Features.MidrandBooks\LiteCharms.Features.MidrandBooks.csproj" />
|
||||||
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Xunit" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"BookshopS3Settings": {
|
||||||
|
"ServiceUrl": "http://192.168.1.177:30900",
|
||||||
|
"Region": "garage",
|
||||||
|
"BucketName": "bookshop",
|
||||||
|
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
|
||||||
|
},
|
||||||
|
"BookshopQuotesS3Settings": {
|
||||||
|
"ServiceUrl": "http://192.168.1.177:30900",
|
||||||
|
"Region": "garage",
|
||||||
|
"BucketName": "bookshop.quotes",
|
||||||
|
"CdnBaseUrl": "https://bookshop.quotes.cdn.khongisa.co.za"
|
||||||
|
},
|
||||||
|
"Email": {
|
||||||
|
"Credentials": {
|
||||||
|
"Username": "shop@litecharms.co.za"
|
||||||
|
},
|
||||||
|
"Port": 465,
|
||||||
|
"Host": "mail.litecharms.co.za",
|
||||||
|
"UseSsl": true
|
||||||
|
},
|
||||||
|
"Monitoring": {
|
||||||
|
"ApiKey": "",
|
||||||
|
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
||||||
|
"ServiceName": "LiteCharms.LeadGenerator"
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using LiteCharms.Features.MidrandBooks.HealthChecks;
|
||||||
|
using static LiteCharms.Features.Extensions.Postgres;
|
||||||
|
using static LiteCharms.Features.MidrandBooks.Extensions.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||||
|
|
||||||
|
public static class HealthChecks
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddMidrandShopQuartzHealthCheck(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHealthChecks().AddCheck<MidrandShopQuartzHealthCheck>(SchedulerDbConfigName);
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IServiceCollection AddMidrandShopPostgresHealthCheck(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHealthChecks().AddCheck<PostgresMidrandShopHealthCheck>(MidrandShopDbConfigName);
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IServiceCollection AddHealthChecksSupport(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddHealthChecks()
|
||||||
|
.AddCheck("Self", () => HealthCheckResult.Healthy());
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using LiteCharms.Features.MidrandBooks.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||||
|
|
||||||
|
public static class Postgres
|
||||||
|
{
|
||||||
|
public const string MidrandShopDbConfigName = "PostgresMidrandBooks";
|
||||||
|
|
||||||
|
public static IServiceCollection AddMidrandShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddPooledDbContextFactory<MidrandShopDbContext>(options =>
|
||||||
|
options.UseNpgsql(configuration.GetConnectionString(MidrandShopDbConfigName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using static LiteCharms.Features.Extensions.Quartz;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.MidrandBooks.HealthChecks;
|
||||||
|
|
||||||
|
public class MidrandShopQuartzHealthCheck(ISchedulerFactory schedulerFactory) : IHealthCheck
|
||||||
|
{
|
||||||
|
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var scheduler = await schedulerFactory.GetScheduler(MidrandShopSchedulerName, cancellationToken);
|
||||||
|
|
||||||
|
if(scheduler == null)
|
||||||
|
return HealthCheckResult.Unhealthy($"Scheduler with name '{MidrandShopSchedulerName}' not found.");
|
||||||
|
|
||||||
|
if (!scheduler.IsStarted)
|
||||||
|
return HealthCheckResult.Unhealthy($"{MidrandShopSchedulerName} Quartz scheduler is not running");
|
||||||
|
|
||||||
|
await scheduler.CheckExists(new JobKey(Guid.NewGuid().ToString()), cancellationToken);
|
||||||
|
|
||||||
|
return HealthCheckResult.Healthy($"{MidrandShopSchedulerName} Quartz scheduler is ready");
|
||||||
|
}
|
||||||
|
catch (SchedulerException)
|
||||||
|
{
|
||||||
|
return HealthCheckResult.Unhealthy($"{MidrandShopSchedulerName} Quartz scheduler cannot connect to the store");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using static LiteCharms.Features.MidrandBooks.Extensions.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.MidrandBooks.HealthChecks;
|
||||||
|
|
||||||
|
public class PostgresMidrandShopHealthCheck(IConfiguration configuration) : IHealthCheck
|
||||||
|
{
|
||||||
|
private readonly string connectionString = configuration.GetConnectionString(MidrandShopDbConfigName)!;
|
||||||
|
|
||||||
|
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await using var dataSource = NpgsqlDataSource.Create(connectionString);
|
||||||
|
await using var connection = await dataSource.OpenConnectionAsync(cancellationToken);
|
||||||
|
|
||||||
|
await using var command = connection.CreateCommand();
|
||||||
|
command.CommandText = "SELECT 1";
|
||||||
|
|
||||||
|
await command.ExecuteScalarAsync(cancellationToken);
|
||||||
|
|
||||||
|
return HealthCheckResult.Healthy($"{MidrandShopDbConfigName} is responsive.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return HealthCheckResult.Unhealthy($"{MidrandShopDbConfigName} is unreachable.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<SignAssembly>True</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>..\LiteCharms.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<UserSecretsId>5be62f49-3ed0-4468-884e-1b04e048b45a</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Nuget Package Details -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<PackageId>LiteCharms.Features.MidrandBooks</PackageId>
|
||||||
|
<Version>1.0.20</Version>
|
||||||
|
<Authors>Khwezi Mngoma</Authors>
|
||||||
|
<Company>Lite Charms (PTY) Ltd</Company>
|
||||||
|
<Description>MidrandBooks feature components for Lite Charms applications.</Description>
|
||||||
|
<PackageProjectUrl>https://gitea.khongisa.co.za/litecharms/components</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://gitea.khongisa.co.za/litecharms/components.git</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
|
<PackageTags>utility;dotnet</PackageTags>
|
||||||
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\LICENSE" Pack="true" PackagePath="\" />
|
||||||
|
<None Include="..\icon.png" Pack="true" PackagePath="\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Quartz Scheduler-->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="OpenTelemetry" Version="1.15.3" />
|
||||||
|
<PackageReference Include="Quartz" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Plugins" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Plugins.TimeZoneConverter" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Serialization.SystemTextJson" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.AspNetCore" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.18.1" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Quartz" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Configuration -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.8" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Microsoft.Extensions.Configuration" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Health Checks -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Core" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Data" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="9.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="10.0.8" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
|
||||||
|
<Using Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Open Telemetry -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.3" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.2" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.1" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.15.3" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="OpenTelemetry.Resources" />
|
||||||
|
<Using Include="OpenTelemetry.Exporter" />
|
||||||
|
<Using Include="OpenTelemetry.Logs" />
|
||||||
|
<Using Include="OpenTelemetry.Metrics" />
|
||||||
|
<Using Include="OpenTelemetry.Trace" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Database -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.8">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.8">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Npgsql" />
|
||||||
|
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||||
|
<Using Include="Microsoft.EntityFrameworkCore.Design" />
|
||||||
|
<Using Include="Microsoft.EntityFrameworkCore.Metadata.Builders" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Email -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MailKit" Version="4.16.0" />
|
||||||
|
<PackageReference Include="MimeKit" Version="4.16.0" />
|
||||||
|
|
||||||
|
<!-- Global Usings-->
|
||||||
|
<Using Include="MimeKit" />
|
||||||
|
<Using Include="MailKit.Net.Smtp" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- CQRS -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="FluentResults" Version="4.0.0" />
|
||||||
|
<PackageReference Include="Mediator.Abstractions" Version="3.0.2" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="FluentResults" />
|
||||||
|
<Using Include="Mediator" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Amazon S3 SDK -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.1" />
|
||||||
|
<PackageReference Include="AWSSDK.S3" Version="4.0.23.4" />
|
||||||
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
|
||||||
|
<!-- global Usings -->
|
||||||
|
<Using Include="Amazon.S3" />
|
||||||
|
<Using Include="Amazon.S3.Model" />
|
||||||
|
<Using Include="Amazon.Runtime" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Shared Usings -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Microsoft.AspNetCore.Builder" />
|
||||||
|
<Using Include="Microsoft.Extensions.Hosting" />
|
||||||
|
<Using Include="System.Text" />
|
||||||
|
<Using Include="System.Text.Json" />
|
||||||
|
<Using Include="System.Threading.Channels" />
|
||||||
|
<Using Include="System.Collections.ObjectModel" />
|
||||||
|
<Using Include="System.Diagnostics" />
|
||||||
|
<Using Include="System.Diagnostics.Metrics" />
|
||||||
|
<Using Include="Microsoft.Extensions.DependencyInjection" />
|
||||||
|
<Using Include="System.Security.Cryptography" />
|
||||||
|
<Using Include="Microsoft.Extensions.Options" />
|
||||||
|
<Using Include="Microsoft.Extensions.Logging" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace LiteCharms.Features.MidrandBooks.Postgres;
|
||||||
|
|
||||||
|
public class MidrandShopDbContext(DbContextOptions<MidrandShopDbContext> options) : DbContext(options)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using static LiteCharms.Features.MidrandBooks.Extensions.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.MidrandBooks.Postgres;
|
||||||
|
|
||||||
|
public class MidrandShopDbContextFactory : IDesignTimeDbContextFactory<MidrandShopDbContext>
|
||||||
|
{
|
||||||
|
public MidrandShopDbContext CreateDbContext(string[] args)
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddUserSecrets(typeof(MidrandShopDbContext).Assembly)
|
||||||
|
.AddJsonFile("appsettings.json")
|
||||||
|
.AddEnvironmentVariables()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var optionsBuilder = new DbContextOptionsBuilder<MidrandShopDbContext>();
|
||||||
|
optionsBuilder.UseNpgsql(configuration.GetConnectionString(MidrandShopDbConfigName));
|
||||||
|
|
||||||
|
return new MidrandShopDbContext(optionsBuilder.Options);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"Email": {
|
||||||
|
"Credentials": {
|
||||||
|
"Username": "shop@litecharms.co.za"
|
||||||
|
},
|
||||||
|
"Port": 465,
|
||||||
|
"Host": "mail.litecharms.co.za",
|
||||||
|
"UseSsl": true
|
||||||
|
},
|
||||||
|
"Monitoring": {
|
||||||
|
"ApiKey": "",
|
||||||
|
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
||||||
|
"ServiceName": "MidrandBooks"
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using LiteCharms.Features.Extensions;
|
||||||
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Tests;
|
||||||
|
|
||||||
|
public class Fixture : IDisposable
|
||||||
|
{
|
||||||
|
public IConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
|
public IServiceProvider Services { get; set; }
|
||||||
|
|
||||||
|
public IMediator Mediator { get; set; }
|
||||||
|
|
||||||
|
public Fixture()
|
||||||
|
{
|
||||||
|
Configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddUserSecrets<Fixture>()
|
||||||
|
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: true)
|
||||||
|
.AddEnvironmentVariables()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Services = new ServiceCollection()
|
||||||
|
.AddMediator()
|
||||||
|
.AddLogging()
|
||||||
|
.AddTechShopServices()
|
||||||
|
.AddEmailServiceBus()
|
||||||
|
.AddGarageS3(Configuration)
|
||||||
|
.AddTechShopDatabase(Configuration)
|
||||||
|
.AddEmailServices(Configuration)
|
||||||
|
.AddSingleton(Configuration)
|
||||||
|
.BuildServiceProvider();
|
||||||
|
|
||||||
|
Mediator = Services.GetRequiredService<IMediator>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<UserSecretsId>fa06c1a6-2ba8-4c47-b19b-11e0f78e7b92</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="10.0.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Mediator.SourceGenerator" Version="3.0.2">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
|
||||||
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Mediator" />
|
||||||
|
<Using Include="Xunit.Abstractions" />
|
||||||
|
<Using Include="Microsoft.Extensions.DependencyInjection" />
|
||||||
|
<Using Include="Microsoft.Extensions.Configuration" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LiteCharms.Features.TechShop\LiteCharms.Features.TechShop.csproj" />
|
||||||
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Xunit" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
+12
-11
@@ -1,27 +1,28 @@
|
|||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.Notifications;
|
using LiteCharms.Features.TechShop.Notifications;
|
||||||
using LiteCharms.Features.Shop.Notifications.Events;
|
using LiteCharms.Features.TechShop.Notifications.Events;
|
||||||
|
using static LiteCharms.Features.Extensions.Email;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Tests;
|
namespace LiteCharms.Features.TechShop.Tests;
|
||||||
|
|
||||||
public class NotificationsFeatureTests(CommonFixture fixture, ITestOutputHelper output) : IClassFixture<CommonFixture>
|
public class NotificationsFeatureTests(Fixture fixture, ITestOutputHelper output) : IClassFixture<Fixture>
|
||||||
{
|
{
|
||||||
private readonly NotificationService notificationService = fixture.Services.GetRequiredService<NotificationService>();
|
private readonly NotificationService notificationService = fixture.Services.GetRequiredService<NotificationService>();
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateNotificationCommand_ShouldSucceed()
|
public async Task CreateNotificationCommand_ShouldSucceed()
|
||||||
{
|
{
|
||||||
Shop.Notifications.Models.CreateNotification request = new()
|
Notifications.Models.CreateNotification request = new()
|
||||||
{
|
{
|
||||||
CorrelationId = Guid.CreateVersion7().ToString(),
|
CorrelationId = Guid.CreateVersion7().ToString(),
|
||||||
CorrelationIdType = Shop.CorrelationIdTypes.None,
|
CorrelationIdType = CorrelationIdTypes.None,
|
||||||
Direction = Shop.NotificationDirection.Outgoing,
|
Direction = NotificationDirection.Outgoing,
|
||||||
Platform = Shop.NotificationPlatforms.Email,
|
Platform = NotificationPlatforms.Email,
|
||||||
Priority = Shop.Priorities.Medium,
|
Priority = Priorities.Medium,
|
||||||
Sender = "xUnit Test",
|
Sender = "xUnit Test",
|
||||||
SenderAddress = "khwezi@mngoma.africa",
|
SenderAddress = "khwezi@mngoma.africa",
|
||||||
Recipient = $"{Email.Extensions.Constants.ShopEmailFromName} [Test]",
|
Recipient = $"{ShopEmailFromName} [Test]",
|
||||||
RecipientAddress = Email.Extensions.Constants.ShopEmailFromAddress,
|
RecipientAddress = ShopEmailFromAddress,
|
||||||
Subject = "Test Message",
|
Subject = "Test Message",
|
||||||
Message = "This is an automation test",
|
Message = "This is an automation test",
|
||||||
IsHtml = false,
|
IsHtml = false,
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using LiteCharms.Features.TechShop.Products;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Tests;
|
||||||
|
|
||||||
|
public class ProductsFeatureTests(Fixture fixture, ITestOutputHelper output) : IClassFixture<Fixture>
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task GetProductsAsync_ReturnsProducts()
|
||||||
|
{
|
||||||
|
var productService = fixture.Services.GetRequiredService<ProductService>();
|
||||||
|
|
||||||
|
var result = await productService.GetProductsAsync();
|
||||||
|
|
||||||
|
Assert.True(result.IsSuccess);
|
||||||
|
Assert.NotNull(result.Value);
|
||||||
|
|
||||||
|
output.WriteLine($"Retrieved {result.Value.Length} products.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"BookshopS3Settings": {
|
||||||
|
"ServiceUrl": "http://192.168.1.177:30900",
|
||||||
|
"Region": "garage",
|
||||||
|
"BucketName": "bookshop",
|
||||||
|
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
|
||||||
|
},
|
||||||
|
"BookshopQuotesS3Settings": {
|
||||||
|
"ServiceUrl": "http://192.168.1.177:30900",
|
||||||
|
"Region": "garage",
|
||||||
|
"BucketName": "bookshop.quotes",
|
||||||
|
"CdnBaseUrl": "https://bookshop.quotes.cdn.khongisa.co.za"
|
||||||
|
},
|
||||||
|
"Email": {
|
||||||
|
"Credentials": {
|
||||||
|
"Username": "shop@litecharms.co.za"
|
||||||
|
},
|
||||||
|
"Port": 465,
|
||||||
|
"Host": "mail.litecharms.co.za",
|
||||||
|
"UseSsl": true
|
||||||
|
},
|
||||||
|
"Monitoring": {
|
||||||
|
"ApiKey": "",
|
||||||
|
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
||||||
|
"ServiceName": "LiteCharms.LeadGenerator"
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.CartPackages.Entities;
|
namespace LiteCharms.Features.TechShop.CartPackages.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<PackageConfirguration, Package>]
|
[EntityTypeConfiguration<PackageConfirguration, Package>]
|
||||||
public class Package : Models.Package
|
public class Package : Models.Package
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.CartPackages.Entities;
|
namespace LiteCharms.Features.TechShop.CartPackages.Entities;
|
||||||
|
|
||||||
public class PackageConfirguration : IEntityTypeConfiguration<Package>
|
public class PackageConfirguration : IEntityTypeConfiguration<Package>
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
using LiteCharms.Features.Shop.Products.Entities;
|
using LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.CartPackages.Entities;
|
namespace LiteCharms.Features.TechShop.CartPackages.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<PackageItemConfiguration, PackageItem>]
|
[EntityTypeConfiguration<PackageItemConfiguration, PackageItem>]
|
||||||
public class PackageItem : Models.PackageItem
|
public class PackageItem : Models.PackageItem
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.CartPackages.Entities;
|
namespace LiteCharms.Features.TechShop.CartPackages.Entities;
|
||||||
|
|
||||||
public class PackageItemConfiguration : IEntityTypeConfiguration<PackageItem>
|
public class PackageItemConfiguration : IEntityTypeConfiguration<PackageItem>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.CartPackages.Models;
|
namespace LiteCharms.Features.TechShop.CartPackages.Models;
|
||||||
|
|
||||||
public class Package
|
public class Package
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.CartPackages.Models;
|
namespace LiteCharms.Features.TechShop.CartPackages.Models;
|
||||||
|
|
||||||
public class PackageItem
|
public class PackageItem
|
||||||
{
|
{
|
||||||
+4
-3
@@ -1,9 +1,10 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.CartPackages.Models;
|
using LiteCharms.Features.TechShop.CartPackages.Models;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.CartPackages;
|
namespace LiteCharms.Features.TechShop.CartPackages;
|
||||||
|
|
||||||
public class PackageService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class PackageService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+4
-3
@@ -1,9 +1,10 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.Customers.Models;
|
using LiteCharms.Features.TechShop.Customers.Models;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Customers;
|
namespace LiteCharms.Features.TechShop.Customers;
|
||||||
|
|
||||||
public class CustomerService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class CustomerService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+5
-5
@@ -1,9 +1,9 @@
|
|||||||
using LiteCharms.Features.Shop.Leads.Entities;
|
using LiteCharms.Features.TechShop.Leads.Entities;
|
||||||
using LiteCharms.Features.Shop.Orders.Entities;
|
using LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
using LiteCharms.Features.Shop.Quotes.Entities;
|
using LiteCharms.Features.TechShop.Quotes.Entities;
|
||||||
using LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
using LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Customers.Entities;
|
namespace LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<CustomerConfiguration, Customer>]
|
[EntityTypeConfiguration<CustomerConfiguration, Customer>]
|
||||||
public class Customer : Models.Customer
|
public class Customer : Models.Customer
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Customers.Entities;
|
namespace LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
|
|
||||||
public class CustomerConfiguration : IEntityTypeConfiguration<Customer>
|
public class CustomerConfiguration : IEntityTypeConfiguration<Customer>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Customers.Models;
|
namespace LiteCharms.Features.TechShop.Customers.Models;
|
||||||
|
|
||||||
public class Customer
|
public class Customer
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Customers.Models;
|
namespace LiteCharms.Features.TechShop.Customers.Models;
|
||||||
|
|
||||||
public record CreateCustomer
|
public record CreateCustomer
|
||||||
{
|
{
|
||||||
@@ -1,16 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop;
|
namespace LiteCharms.Features.TechShop;
|
||||||
|
|
||||||
public enum EmailStatuses : int
|
|
||||||
{
|
|
||||||
GeneralError = 0,
|
|
||||||
AuthenticationError = 1,
|
|
||||||
ProtocolError = 2,
|
|
||||||
Connected = 3,
|
|
||||||
Disconnected = 4,
|
|
||||||
TooManyConnections = 5,
|
|
||||||
ConnectionAborted = 6,
|
|
||||||
Success = 7
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CorrelationIdTypes : int
|
public enum CorrelationIdTypes : int
|
||||||
{
|
{
|
||||||
@@ -27,13 +15,6 @@ public enum CorrelationIdTypes : int
|
|||||||
LinkedIn = 10
|
LinkedIn = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Priorities : int
|
|
||||||
{
|
|
||||||
Low = 0,
|
|
||||||
Medium = 1,
|
|
||||||
High = 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum NotificationPlatforms : int
|
public enum NotificationPlatforms : int
|
||||||
{
|
{
|
||||||
Email = 1,
|
Email = 1,
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using LiteCharms.Features.TechShop.HealthChecks;
|
||||||
|
using static LiteCharms.Features.TechShop.Extensions.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Extensions;
|
||||||
|
|
||||||
|
public static class HealthChecks
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddShopQuartzHealthCheck(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHealthChecks().AddCheck<ShopQuartzHealthCheck>("ShopQuartz");
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static IServiceCollection AddShopPostgresHealthCheck(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHealthChecks().AddCheck<PostgresShopHealthCheck>(TechShopDbConfigName);
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
-23
@@ -1,17 +1,18 @@
|
|||||||
using LiteCharms.Features.Shop.CartPackages.Models;
|
using LiteCharms.Features.TechShop.CartPackages.Models;
|
||||||
using LiteCharms.Features.Shop.Customers.Models;
|
using LiteCharms.Features.TechShop.Customers.Models;
|
||||||
using LiteCharms.Features.Shop.Leads.Models;
|
using LiteCharms.Features.TechShop.Leads.Models;
|
||||||
using LiteCharms.Features.Shop.Notifications.Models;
|
using LiteCharms.Features.TechShop.Notifications.Models;
|
||||||
using LiteCharms.Features.Shop.Orders.Models;
|
using LiteCharms.Features.TechShop.Orders.Models;
|
||||||
using LiteCharms.Features.Shop.Products.Models;
|
using LiteCharms.Features.TechShop.Products.Entities;
|
||||||
using LiteCharms.Features.Shop.Quotes.Models;
|
using LiteCharms.Features.TechShop.Products.Models;
|
||||||
using LiteCharms.Features.Shop.ShoppingCarts.Models;
|
using LiteCharms.Features.TechShop.Quotes.Models;
|
||||||
|
using LiteCharms.Features.TechShop.ShoppingCarts.Models;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Extensions;
|
namespace LiteCharms.Features.TechShop.Extensions;
|
||||||
|
|
||||||
public static class EntityModeMappers
|
public static class Mappers
|
||||||
{
|
{
|
||||||
public static ShoppingCartPackage ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartPackage entity) =>
|
public static ShoppingCartPackage ToModel(this ShoppingCarts.Entities.ShoppingCartPackage entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -20,7 +21,7 @@ public static class EntityModeMappers
|
|||||||
ShoppingCartId = entity.ShoppingCartId
|
ShoppingCartId = entity.ShoppingCartId
|
||||||
};
|
};
|
||||||
|
|
||||||
public static PackageItem ToModel(this Features.Shop.CartPackages.Entities.PackageItem entity) =>
|
public static PackageItem ToModel(this CartPackages.Entities.PackageItem entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -30,7 +31,7 @@ public static class EntityModeMappers
|
|||||||
ProductPriceId = entity.ProductPriceId
|
ProductPriceId = entity.ProductPriceId
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Package ToModel(this Features.Shop.CartPackages.Entities.Package entity) =>
|
public static Package ToModel(this CartPackages.Entities.Package entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -43,7 +44,7 @@ public static class EntityModeMappers
|
|||||||
Summary = entity.Summary
|
Summary = entity.Summary
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ShoppingCartItem ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartItem entity) =>
|
public static ShoppingCartItem ToModel(this ShoppingCarts.Entities.ShoppingCartItem entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -54,7 +55,7 @@ public static class EntityModeMappers
|
|||||||
ShoppingCartId = entity.ShoppingCartId
|
ShoppingCartId = entity.ShoppingCartId
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ShoppingCart ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCart entity) =>
|
public static ShoppingCart ToModel(this ShoppingCarts.Entities.ShoppingCart entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -64,7 +65,7 @@ public static class EntityModeMappers
|
|||||||
OrderId = entity.OrderId
|
OrderId = entity.OrderId
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Quote ToModel(this Features.Shop.Quotes.Entities.Quote entity) =>
|
public static Quote ToModel(this Quotes.Entities.Quote entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -79,7 +80,7 @@ public static class EntityModeMappers
|
|||||||
OrderId = entity.OrderId
|
OrderId = entity.OrderId
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Notification ToModel(this Features.Shop.Notifications.Entities.Notification entity) =>
|
public static Notification ToModel(this Notifications.Entities.Notification entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -103,7 +104,7 @@ public static class EntityModeMappers
|
|||||||
Errors = entity.Errors
|
Errors = entity.Errors
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Customer ToModel(this Features.Shop.Customers.Entities.Customer entity) =>
|
public static Customer ToModel(this Customers.Entities.Customer entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -128,7 +129,7 @@ public static class EntityModeMappers
|
|||||||
Whatsapp = entity.Whatsapp
|
Whatsapp = entity.Whatsapp
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Lead ToModel(this Features.Shop.Leads.Entities.Lead entity) =>
|
public static Lead ToModel(this Leads.Entities.Lead entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -149,7 +150,7 @@ public static class EntityModeMappers
|
|||||||
Status = entity.Status
|
Status = entity.Status
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Order ToModel(this Features.Shop.Orders.Entities.Order entity) =>
|
public static Order ToModel(this Orders.Entities.Order entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -163,7 +164,7 @@ public static class EntityModeMappers
|
|||||||
InvoiceUrl = entity.InvoiceUrl
|
InvoiceUrl = entity.InvoiceUrl
|
||||||
};
|
};
|
||||||
|
|
||||||
public static OrderRefund ToModel(this Features.Shop.Orders.Entities.OrderRefund entity) =>
|
public static OrderRefund ToModel(this Orders.Entities.OrderRefund entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -173,7 +174,7 @@ public static class EntityModeMappers
|
|||||||
Amount = entity.Amount
|
Amount = entity.Amount
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Product ToModel(this Features.Shop.Products.Entities.Product entity) =>
|
public static Products.Models.Product ToModel(this Products.Entities.Product entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -187,7 +188,7 @@ public static class EntityModeMappers
|
|||||||
Metadata = entity.Metadata,
|
Metadata = entity.Metadata,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ProductPrice ToModel(this Features.Shop.Products.Entities.ProductPrice entity) =>
|
public static Products.Models.ProductPrice ToModel(this Products.Entities.ProductPrice entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Extensions;
|
||||||
|
|
||||||
|
public static class Postgres
|
||||||
|
{
|
||||||
|
public const string TechShopDbConfigName = "PostgresShop";
|
||||||
|
|
||||||
|
public static IServiceCollection AddTechShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddPooledDbContextFactory<ShopDbContext>(options =>
|
||||||
|
options.UseNpgsql(configuration.GetConnectionString(TechShopDbConfigName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using LiteCharms.Features.TechShop.CartPackages;
|
||||||
|
using LiteCharms.Features.TechShop.Customers;
|
||||||
|
using LiteCharms.Features.TechShop.Leads;
|
||||||
|
using LiteCharms.Features.TechShop.Notifications;
|
||||||
|
using LiteCharms.Features.TechShop.Orders;
|
||||||
|
using LiteCharms.Features.TechShop.Products;
|
||||||
|
using LiteCharms.Features.TechShop.Quotes;
|
||||||
|
using LiteCharms.Features.TechShop.ShoppingCarts;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Extensions;
|
||||||
|
|
||||||
|
public static class Shop
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddTechShopServices(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<PackageService>()
|
||||||
|
.AddSingleton<LeadService>()
|
||||||
|
.AddSingleton<NotificationService>()
|
||||||
|
.AddSingleton<OrderService>()
|
||||||
|
.AddSingleton<ProductService>()
|
||||||
|
.AddSingleton<QuoteService>()
|
||||||
|
.AddSingleton<ShoppingCartService>()
|
||||||
|
.AddSingleton<CustomerService>();
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-5
@@ -1,8 +1,10 @@
|
|||||||
namespace LiteCharms.Features.HealthChecks;
|
using static LiteCharms.Features.TechShop.Extensions.Postgres;
|
||||||
|
|
||||||
public class PostgresHealthCheck(IConfiguration configuration) : IHealthCheck
|
namespace LiteCharms.Features.TechShop.HealthChecks;
|
||||||
|
|
||||||
|
public class PostgresShopHealthCheck(IConfiguration configuration) : IHealthCheck
|
||||||
{
|
{
|
||||||
private readonly string connectionString = configuration.GetConnectionString("PostgresShop")!;
|
private readonly string connectionString = configuration.GetConnectionString(TechShopDbConfigName)!;
|
||||||
|
|
||||||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
@@ -16,11 +18,11 @@ public class PostgresHealthCheck(IConfiguration configuration) : IHealthCheck
|
|||||||
|
|
||||||
await command.ExecuteScalarAsync(cancellationToken);
|
await command.ExecuteScalarAsync(cancellationToken);
|
||||||
|
|
||||||
return HealthCheckResult.Healthy("PostgreSQL is responsive.");
|
return HealthCheckResult.Healthy($"{TechShopDbConfigName} is responsive.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return HealthCheckResult.Unhealthy("PostgreSQL is unreachable.", ex);
|
return HealthCheckResult.Unhealthy($"{TechShopDbConfigName} is unreachable.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using static LiteCharms.Features.Extensions.Quartz;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.HealthChecks;
|
||||||
|
|
||||||
|
public class ShopQuartzHealthCheck(ISchedulerFactory schedulerFactory) : IHealthCheck
|
||||||
|
{
|
||||||
|
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var scheduler = await schedulerFactory.GetScheduler(TechShopSchedulerName, cancellationToken);
|
||||||
|
|
||||||
|
if(scheduler == null)
|
||||||
|
return HealthCheckResult.Unhealthy($"Scheduler with name '{TechShopSchedulerName}' not found.");
|
||||||
|
|
||||||
|
if (!scheduler.IsStarted)
|
||||||
|
return HealthCheckResult.Unhealthy($"{TechShopSchedulerName} Quartz scheduler is not running");
|
||||||
|
|
||||||
|
await scheduler.CheckExists(new JobKey(Guid.NewGuid().ToString()), cancellationToken);
|
||||||
|
|
||||||
|
return HealthCheckResult.Healthy($"{TechShopSchedulerName} Quartz scheduler is ready");
|
||||||
|
}
|
||||||
|
catch (SchedulerException)
|
||||||
|
{
|
||||||
|
return HealthCheckResult.Unhealthy($"{TechShopSchedulerName} Quartz scheduler cannot connect to the store");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
using LiteCharms.Features.Shop.Customers.Entities;
|
using LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Leads.Entities;
|
namespace LiteCharms.Features.TechShop.Leads.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<LeadConfiguration, Lead>]
|
[EntityTypeConfiguration<LeadConfiguration, Lead>]
|
||||||
public class Lead : Models.Lead
|
public class Lead : Models.Lead
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Leads.Entities;
|
namespace LiteCharms.Features.TechShop.Leads.Entities;
|
||||||
|
|
||||||
public class LeadConfiguration : IEntityTypeConfiguration<Lead>
|
public class LeadConfiguration : IEntityTypeConfiguration<Lead>
|
||||||
{
|
{
|
||||||
+4
-3
@@ -1,10 +1,11 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.Leads.Models;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Leads.Models;
|
||||||
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using static LiteCharms.Features.Extensions.Hash;
|
using static LiteCharms.Features.Extensions.Hash;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Leads;
|
namespace LiteCharms.Features.TechShop.Leads;
|
||||||
|
|
||||||
public class LeadService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class LeadService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Leads.Models;
|
namespace LiteCharms.Features.TechShop.Leads.Models;
|
||||||
|
|
||||||
public class Lead
|
public class Lead
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Leads.Models;
|
namespace LiteCharms.Features.TechShop.Leads.Models;
|
||||||
|
|
||||||
public record CreateLead
|
public record CreateLead
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<SignAssembly>True</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>..\LiteCharms.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<UserSecretsId>fbd8f4a2-0420-44e2-baff-4678d9e7eee1</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Nuget Package Details -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<PackageId>LiteCharms.Features.TechShop</PackageId>
|
||||||
|
<Version>1.0.20</Version>
|
||||||
|
<Authors>Khwezi Mngoma</Authors>
|
||||||
|
<Company>Lite Charms (PTY) Ltd</Company>
|
||||||
|
<Description>TechShop feature components for Lite Charms applications.</Description>
|
||||||
|
<PackageProjectUrl>https://gitea.khongisa.co.za/litecharms/components</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://gitea.khongisa.co.za/litecharms/components.git</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
|
<PackageTags>utility;dotnet</PackageTags>
|
||||||
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\LICENSE" Pack="true" PackagePath="\" />
|
||||||
|
<None Include="..\icon.png" Pack="true" PackagePath="\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Quartz Scheduler-->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="OpenTelemetry" Version="1.15.3" />
|
||||||
|
<PackageReference Include="Quartz" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Plugins" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Plugins.TimeZoneConverter" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Serialization.SystemTextJson" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.AspNetCore" Version="3.18.1" />
|
||||||
|
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.18.1" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Quartz" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Configuration -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.8" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Microsoft.Extensions.Configuration" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Health Checks -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Core" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Data" Version="9.0.0" />
|
||||||
|
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="9.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="10.0.8" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
|
||||||
|
<Using Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Open Telemetry -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.3" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.2" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.1" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.15.3" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="OpenTelemetry.Resources" />
|
||||||
|
<Using Include="OpenTelemetry.Exporter" />
|
||||||
|
<Using Include="OpenTelemetry.Logs" />
|
||||||
|
<Using Include="OpenTelemetry.Metrics" />
|
||||||
|
<Using Include="OpenTelemetry.Trace" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Database -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.8">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.8">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="Npgsql" />
|
||||||
|
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||||
|
<Using Include="Microsoft.EntityFrameworkCore.Design" />
|
||||||
|
<Using Include="Microsoft.EntityFrameworkCore.Metadata.Builders" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Email -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MailKit" Version="4.16.0" />
|
||||||
|
<PackageReference Include="MimeKit" Version="4.16.0" />
|
||||||
|
|
||||||
|
<!-- Global Usings-->
|
||||||
|
<Using Include="MimeKit" />
|
||||||
|
<Using Include="MailKit.Net.Smtp" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- CQRS -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="FluentResults" Version="4.0.0" />
|
||||||
|
<PackageReference Include="Mediator.Abstractions" Version="3.0.2" />
|
||||||
|
|
||||||
|
<!-- Global Usings -->
|
||||||
|
<Using Include="FluentResults" />
|
||||||
|
<Using Include="Mediator" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Amazon S3 SDK -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.1" />
|
||||||
|
<PackageReference Include="AWSSDK.S3" Version="4.0.23.4" />
|
||||||
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
|
||||||
|
<!-- global Usings -->
|
||||||
|
<Using Include="Amazon.S3" />
|
||||||
|
<Using Include="Amazon.S3.Model" />
|
||||||
|
<Using Include="Amazon.Runtime" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Shared Usings -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Microsoft.AspNetCore.Builder" />
|
||||||
|
<Using Include="Microsoft.Extensions.Hosting" />
|
||||||
|
<Using Include="System.Text" />
|
||||||
|
<Using Include="System.Text.Json" />
|
||||||
|
<Using Include="System.Threading.Channels" />
|
||||||
|
<Using Include="System.Collections.ObjectModel" />
|
||||||
|
<Using Include="System.Diagnostics" />
|
||||||
|
<Using Include="System.Diagnostics.Metrics" />
|
||||||
|
<Using Include="Microsoft.Extensions.DependencyInjection" />
|
||||||
|
<Using Include="System.Security.Cryptography" />
|
||||||
|
<Using Include="Microsoft.Extensions.Options" />
|
||||||
|
<Using Include="Microsoft.Extensions.Logging" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Notifications.Entities;
|
namespace LiteCharms.Features.TechShop.Notifications.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<NotificationConfiguration, Notification>]
|
[EntityTypeConfiguration<NotificationConfiguration, Notification>]
|
||||||
public class Notification : Models.Notification;
|
public class Notification : Models.Notification;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Notifications.Entities;
|
namespace LiteCharms.Features.TechShop.Notifications.Entities;
|
||||||
|
|
||||||
public class NotificationConfiguration : IEntityTypeConfiguration<Notification>
|
public class NotificationConfiguration : IEntityTypeConfiguration<Notification>
|
||||||
{
|
{
|
||||||
+4
-5
@@ -1,9 +1,8 @@
|
|||||||
using k8s.KubeConfigModels;
|
using LiteCharms.Features.Email;
|
||||||
using LiteCharms.Features.Email;
|
using LiteCharms.Features.TechShop.Notifications.Models;
|
||||||
using LiteCharms.Features.Shop.Notifications.Models;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Notifications.Events.Handlers;
|
namespace LiteCharms.Features.TechShop.Notifications.Events.Handlers;
|
||||||
|
|
||||||
public class ProcessEmailNotificationsEventHandler(IDbContextFactory<ShopDbContext> contextFactory, ILogger<ProcessEmailNotificationsEvent> logger,
|
public class ProcessEmailNotificationsEventHandler(IDbContextFactory<ShopDbContext> contextFactory, ILogger<ProcessEmailNotificationsEvent> logger,
|
||||||
EmailService emailService) : INotificationHandler<ProcessEmailNotificationsEvent>
|
EmailService emailService) : INotificationHandler<ProcessEmailNotificationsEvent>
|
||||||
+3
-5
@@ -1,14 +1,12 @@
|
|||||||
using LiteCharms.Features.Shop;
|
using static LiteCharms.Features.Extensions.Email;
|
||||||
using LiteCharms.Features.Shop.Notifications;
|
|
||||||
using static LiteCharms.Features.Email.Extensions.Constants;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.Email.Events.Handlers;
|
namespace LiteCharms.Features.TechShop.Notifications.Events.Handlers;
|
||||||
|
|
||||||
public class SendShopEmailEnquiryEventHandler(NotificationService notificationService) :
|
public class SendShopEmailEnquiryEventHandler(NotificationService notificationService) :
|
||||||
INotificationHandler<SendShopEmailEnquiryEvent>
|
INotificationHandler<SendShopEmailEnquiryEvent>
|
||||||
{
|
{
|
||||||
public async ValueTask Handle(SendShopEmailEnquiryEvent notification, CancellationToken cancellationToken) =>
|
public async ValueTask Handle(SendShopEmailEnquiryEvent notification, CancellationToken cancellationToken) =>
|
||||||
await notificationService.CreateNotificationAsync(new Shop.Notifications.Models.CreateNotification
|
await notificationService.CreateNotificationAsync(new Models.CreateNotification
|
||||||
{
|
{
|
||||||
CorrelationId = notification.CorrelationId,
|
CorrelationId = notification.CorrelationId,
|
||||||
CorrelationIdType = CorrelationIdTypes.None,
|
CorrelationIdType = CorrelationIdTypes.None,
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using LiteCharms.Features.Abstractions;
|
using LiteCharms.Features.Abstractions;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Notifications.Events;
|
namespace LiteCharms.Features.TechShop.Notifications.Events;
|
||||||
|
|
||||||
public class ProcessEmailNotificationsEvent : EventBase, IEvent
|
public class ProcessEmailNotificationsEvent : EventBase, IEvent
|
||||||
{
|
{
|
||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
using LiteCharms.Features.Abstractions;
|
using LiteCharms.Features.Abstractions;
|
||||||
using LiteCharms.Features.Shop;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.Email.Events;
|
namespace LiteCharms.Features.TechShop.Notifications.Events;
|
||||||
|
|
||||||
public class SendShopEmailEnquiryEvent : EventBase, IEvent
|
public class SendShopEmailEnquiryEvent : EventBase, IEvent
|
||||||
{
|
{
|
||||||
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
namespace LiteCharms.Features.Shop.Notifications.Models;
|
using LiteCharms.Features.TechShop;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Notifications.Models;
|
||||||
|
|
||||||
public class Notification
|
public class Notification
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Notifications.Models;
|
namespace LiteCharms.Features.TechShop.Notifications.Models;
|
||||||
|
|
||||||
public record CreateNotification
|
public record CreateNotification
|
||||||
{
|
{
|
||||||
+4
-3
@@ -1,9 +1,10 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.Notifications.Models;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Notifications.Models;
|
||||||
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Notifications;
|
namespace LiteCharms.Features.TechShop.Notifications;
|
||||||
|
|
||||||
public class NotificationService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class NotificationService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
using LiteCharms.Features.Shop.Customers.Entities;
|
using LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
using LiteCharms.Features.Shop.Quotes.Entities;
|
using LiteCharms.Features.TechShop.Quotes.Entities;
|
||||||
using LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
using LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Orders.Entities;
|
namespace LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<OrderConfiguration, Order>]
|
[EntityTypeConfiguration<OrderConfiguration, Order>]
|
||||||
public class Order : Models.Order
|
public class Order : Models.Order
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Orders.Entities;
|
namespace LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
|
|
||||||
public class OrderConfiguration : IEntityTypeConfiguration<Order>
|
public class OrderConfiguration : IEntityTypeConfiguration<Order>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Orders.Entities;
|
namespace LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<OrderRefundConfiguration, OrderRefund>]
|
[EntityTypeConfiguration<OrderRefundConfiguration, OrderRefund>]
|
||||||
public class OrderRefund : Models.OrderRefund
|
public class OrderRefund : Models.OrderRefund
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Orders.Entities;
|
namespace LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
|
|
||||||
public class OrderRefundConfiguration : IEntityTypeConfiguration<OrderRefund>
|
public class OrderRefundConfiguration : IEntityTypeConfiguration<OrderRefund>
|
||||||
{
|
{
|
||||||
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
namespace LiteCharms.Features.Shop.Orders.Models;
|
using LiteCharms.Features.TechShop;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Orders.Models;
|
||||||
|
|
||||||
public class Order
|
public class Order
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Orders.Models;
|
namespace LiteCharms.Features.TechShop.Orders.Models;
|
||||||
|
|
||||||
public class OrderRefund
|
public class OrderRefund
|
||||||
{
|
{
|
||||||
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
namespace LiteCharms.Features.Shop.Orders.Models;
|
using LiteCharms.Features.TechShop;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Orders.Models;
|
||||||
|
|
||||||
public record CreateOrder
|
public record CreateOrder
|
||||||
{
|
{
|
||||||
+4
-3
@@ -1,9 +1,10 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.Orders.Models;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Orders.Models;
|
||||||
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Orders;
|
namespace LiteCharms.Features.TechShop.Orders;
|
||||||
|
|
||||||
public class OrderService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class OrderService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
@@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ShopDbContext))]
|
[DbContext(typeof(ShopDbContext))]
|
||||||
[Migration("20260512065421_Init")]
|
[Migration("20260512065421_Init")]
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Init : Migration
|
public partial class Init : Migration
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
@@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ShopDbContext))]
|
[DbContext(typeof(ShopDbContext))]
|
||||||
[Migration("20260514004002_UsedStringTableNames")]
|
[Migration("20260514004002_UsedStringTableNames")]
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class UsedStringTableNames : Migration
|
public partial class UsedStringTableNames : Migration
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
@@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ShopDbContext))]
|
[DbContext(typeof(ShopDbContext))]
|
||||||
[Migration("20260515055221_FixedLeadCustomerRelationship")]
|
[Migration("20260515055221_FixedLeadCustomerRelationship")]
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class FixedLeadCustomerRelationship : Migration
|
public partial class FixedLeadCustomerRelationship : Migration
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using LiteCharms.Features.Shop.Products.Models;
|
using LiteCharms.Features.TechShop.Products.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
@@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ShopDbContext))]
|
[DbContext(typeof(ShopDbContext))]
|
||||||
[Migration("20260520191059_AddedProductMetadata")]
|
[Migration("20260520191059_AddedProductMetadata")]
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using LiteCharms.Features.Shop.Products.Models;
|
using LiteCharms.Features.TechShop.Products.Models;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddedProductMetadata : Migration
|
public partial class AddedProductMetadata : Migration
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using LiteCharms.Features.Shop.Products.Models;
|
using LiteCharms.Features.TechShop.Products.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
@@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Postgres.Migrations
|
namespace LiteCharms.Features.TechShop.Postgres.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ShopDbContext))]
|
[DbContext(typeof(ShopDbContext))]
|
||||||
partial class ShopDbContextModelSnapshot : ModelSnapshot
|
partial class ShopDbContextModelSnapshot : ModelSnapshot
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using LiteCharms.Features.TechShop.CartPackages.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.Leads.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.Notifications.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.Quotes.Entities;
|
||||||
|
using LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
|
public class ShopDbContext(DbContextOptions<ShopDbContext> options) : DbContext(options)
|
||||||
|
{
|
||||||
|
public DbSet<Customer> Customers { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Lead> Leads { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Order> Orders { get; set; }
|
||||||
|
|
||||||
|
public DbSet<OrderRefund> OrderRefunds { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Product> Products { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ProductPrice> ProductPrices { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Notification> Notifications { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Quote> Quotes { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ShoppingCart> ShoppingCarts { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ShoppingCartItem> ShoppingCartItems { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Package> Packages { get; set; }
|
||||||
|
|
||||||
|
public DbSet<PackageItem> PackageItems { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ShoppingCartPackage> ShoppingCartPackages { get; set; }
|
||||||
|
}
|
||||||
+4
-2
@@ -1,4 +1,6 @@
|
|||||||
namespace LiteCharms.Features.Shop.Postgres;
|
using static LiteCharms.Features.TechShop.Extensions.Postgres;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.TechShop.Postgres;
|
||||||
|
|
||||||
public class ShopDbContextFactory : IDesignTimeDbContextFactory<ShopDbContext>
|
public class ShopDbContextFactory : IDesignTimeDbContextFactory<ShopDbContext>
|
||||||
{
|
{
|
||||||
@@ -12,7 +14,7 @@ public class ShopDbContextFactory : IDesignTimeDbContextFactory<ShopDbContext>
|
|||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<ShopDbContext>();
|
var optionsBuilder = new DbContextOptionsBuilder<ShopDbContext>();
|
||||||
optionsBuilder.UseNpgsql(configuration.GetConnectionString("PostgresShop"));
|
optionsBuilder.UseNpgsql(configuration.GetConnectionString(TechShopDbConfigName));
|
||||||
|
|
||||||
return new ShopDbContext(optionsBuilder.Options);
|
return new ShopDbContext(optionsBuilder.Options);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Entities;
|
namespace LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<ProductConfiguration, Product>]
|
[EntityTypeConfiguration<ProductConfiguration, Product>]
|
||||||
public class Product : Models.Product
|
public class Product : Models.Product
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Entities;
|
namespace LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
|
||||||
public class ProductConfiguration : IEntityTypeConfiguration<Product>
|
public class ProductConfiguration : IEntityTypeConfiguration<Product>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Entities;
|
namespace LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<ProductPriceConfiguration, ProductPrice>]
|
[EntityTypeConfiguration<ProductPriceConfiguration, ProductPrice>]
|
||||||
public class ProductPrice : Models.ProductPrice
|
public class ProductPrice : Models.ProductPrice
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Entities;
|
namespace LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
|
||||||
public class ProductPriceConfiguration : IEntityTypeConfiguration<ProductPrice>
|
public class ProductPriceConfiguration : IEntityTypeConfiguration<ProductPrice>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Products.Models;
|
namespace LiteCharms.Features.TechShop.Products.Models;
|
||||||
|
|
||||||
public class CreateProductModel
|
public class CreateProductModel
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Models;
|
namespace LiteCharms.Features.TechShop.Products.Models;
|
||||||
|
|
||||||
public class Product
|
public class Product
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Models;
|
namespace LiteCharms.Features.TechShop.Products.Models;
|
||||||
|
|
||||||
public class ProductMetadata
|
public class ProductMetadata
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Models;
|
namespace LiteCharms.Features.TechShop.Products.Models;
|
||||||
|
|
||||||
public class ProductPrice
|
public class ProductPrice
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Products.Models;
|
namespace LiteCharms.Features.TechShop.Products.Models;
|
||||||
|
|
||||||
public record CreateProduct
|
public record CreateProduct
|
||||||
{
|
{
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using LiteCharms.Features.Shop.Products.Models;
|
using LiteCharms.Features.TechShop.Products.Models;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Products;
|
namespace LiteCharms.Features.TechShop.Products;
|
||||||
|
|
||||||
public class ProductService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class ProductService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
using LiteCharms.Features.Shop.Customers.Entities;
|
using LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
using LiteCharms.Features.Shop.Orders.Entities;
|
using LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
using LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
using LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Quotes.Entities;
|
namespace LiteCharms.Features.TechShop.Quotes.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<QuoteConfiguration, Quote>]
|
[EntityTypeConfiguration<QuoteConfiguration, Quote>]
|
||||||
public class Quote : Models.Quote
|
public class Quote : Models.Quote
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Quotes.Entities;
|
namespace LiteCharms.Features.TechShop.Quotes.Entities;
|
||||||
|
|
||||||
public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
|
public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.Quotes.Models;
|
namespace LiteCharms.Features.TechShop.Quotes.Models;
|
||||||
|
|
||||||
public class Quote
|
public class Quote
|
||||||
{
|
{
|
||||||
+4
-3
@@ -1,9 +1,10 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Models;
|
using LiteCharms.Features.Models;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
using LiteCharms.Features.Shop.Quotes.Models;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
|
using LiteCharms.Features.TechShop.Quotes.Models;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.Quotes;
|
namespace LiteCharms.Features.TechShop.Quotes;
|
||||||
|
|
||||||
public class QuoteService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class QuoteService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
using LiteCharms.Features.Shop.Customers.Entities;
|
using LiteCharms.Features.TechShop.Customers.Entities;
|
||||||
using LiteCharms.Features.Shop.Orders.Entities;
|
using LiteCharms.Features.TechShop.Orders.Entities;
|
||||||
using LiteCharms.Features.Shop.Quotes.Entities;
|
using LiteCharms.Features.TechShop.Quotes.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<ShoppingCartConfiguration, ShoppingCart>]
|
[EntityTypeConfiguration<ShoppingCartConfiguration, ShoppingCart>]
|
||||||
public class ShoppingCart : Models.ShoppingCart
|
public class ShoppingCart : Models.ShoppingCart
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
public class ShoppingCartConfiguration : IEntityTypeConfiguration<ShoppingCart>
|
public class ShoppingCartConfiguration : IEntityTypeConfiguration<ShoppingCart>
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
using LiteCharms.Features.Shop.Products.Entities;
|
using LiteCharms.Features.TechShop.Products.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<ShoppingCartItemConfiguration, ShoppingCartItem>]
|
[EntityTypeConfiguration<ShoppingCartItemConfiguration, ShoppingCartItem>]
|
||||||
public class ShoppingCartItem : Models.ShoppingCartItem
|
public class ShoppingCartItem : Models.ShoppingCartItem
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
public class ShoppingCartItemConfiguration : IEntityTypeConfiguration<ShoppingCartItem>
|
public class ShoppingCartItemConfiguration : IEntityTypeConfiguration<ShoppingCartItem>
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
using LiteCharms.Features.Shop.CartPackages.Entities;
|
using LiteCharms.Features.TechShop.CartPackages.Entities;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
[EntityTypeConfiguration<ShoppingCartPackageConfiguration, ShoppingCartPackage>]
|
[EntityTypeConfiguration<ShoppingCartPackageConfiguration, ShoppingCartPackage>]
|
||||||
public class ShoppingCartPackage : Models.ShoppingCartPackage
|
public class ShoppingCartPackage : Models.ShoppingCartPackage
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Entities;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
|
||||||
|
|
||||||
public class ShoppingCartPackageConfiguration : IEntityTypeConfiguration<ShoppingCartPackage>
|
public class ShoppingCartPackageConfiguration : IEntityTypeConfiguration<ShoppingCartPackage>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Models;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Models;
|
||||||
|
|
||||||
public class ShoppingCart
|
public class ShoppingCart
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Models;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Models;
|
||||||
|
|
||||||
public class ShoppingCartItem
|
public class ShoppingCartItem
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Shop.ShoppingCarts.Models;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts.Models;
|
||||||
|
|
||||||
public class ShoppingCartPackage
|
public class ShoppingCartPackage
|
||||||
{
|
{
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.TechShop.Extensions;
|
||||||
using LiteCharms.Features.Shop.Postgres;
|
using LiteCharms.Features.TechShop.Postgres;
|
||||||
using LiteCharms.Features.Shop.ShoppingCarts.Models;
|
using LiteCharms.Features.TechShop.ShoppingCarts.Models;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Shop.ShoppingCarts;
|
namespace LiteCharms.Features.TechShop.ShoppingCarts;
|
||||||
|
|
||||||
public class ShoppingCartService(IDbContextFactory<ShopDbContext> contextFactory)
|
public class ShoppingCartService(IDbContextFactory<ShopDbContext> contextFactory)
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace LiteCharms.Features.Tests;
|
namespace LiteCharms.Features.Tests;
|
||||||
|
|
||||||
public class CommonFixture : IDisposable
|
public class Fixture : IDisposable
|
||||||
{
|
{
|
||||||
public IConfiguration Configuration { get; set; }
|
public IConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
@@ -10,22 +10,20 @@ public class CommonFixture : IDisposable
|
|||||||
|
|
||||||
public IMediator Mediator { get; set; }
|
public IMediator Mediator { get; set; }
|
||||||
|
|
||||||
public CommonFixture()
|
public Fixture()
|
||||||
{
|
{
|
||||||
Configuration = new ConfigurationBuilder()
|
Configuration = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
.AddUserSecrets<CommonFixture>()
|
.AddUserSecrets<Fixture>()
|
||||||
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: true)
|
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: true)
|
||||||
.AddEnvironmentVariables()
|
.AddEnvironmentVariables()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Services = new ServiceCollection()
|
Services = new ServiceCollection()
|
||||||
.AddMediator()
|
.AddMediator()
|
||||||
.AddLogging()
|
.AddLogging()
|
||||||
.AddShopServices()
|
|
||||||
.AddEmailServiceBus()
|
.AddEmailServiceBus()
|
||||||
.AddGarageS3(Configuration)
|
.AddGarageS3(Configuration)
|
||||||
.AddShopDatabase(Configuration)
|
|
||||||
.AddEmailServices(Configuration)
|
.AddEmailServices(Configuration)
|
||||||
.AddSingleton(Configuration)
|
.AddSingleton(Configuration)
|
||||||
.BuildServiceProvider();
|
.BuildServiceProvider();
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="10.0.0">
|
<PackageReference Include="coverlet.collector" Version="10.0.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace LiteCharms.Features.Tests;
|
namespace LiteCharms.Features.Tests;
|
||||||
|
|
||||||
public class S3ServiceFeatureTests(CommonFixture fixture, ITestOutputHelper output) : IClassFixture<CommonFixture>
|
public class S3ServiceFeatureTests(Fixture fixture, ITestOutputHelper output) : IClassFixture<Fixture>
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task BookshopS3Service_MustReturnUrl()
|
public async Task BookshopS3Service_MustReturnUrl()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using LiteCharms.Features.Email.Configuration;
|
using LiteCharms.Features.Email.Configuration;
|
||||||
using LiteCharms.Features.Email.Extensions;
|
using LiteCharms.Features.Email.Extensions;
|
||||||
using LiteCharms.Features.Email.Models;
|
using LiteCharms.Features.Email.Models;
|
||||||
using LiteCharms.Features.Shop;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.Email;
|
namespace LiteCharms.Features.Email;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace LiteCharms.Features.Email.Extensions;
|
|
||||||
|
|
||||||
public static class Constants
|
|
||||||
{
|
|
||||||
public const string ShopSchedulerName = "shop";
|
|
||||||
public const string ShopEmailFromName = "Khongisa Shop";
|
|
||||||
public const string ShopEmailFromAddress = "shop@litecharms.co.za";
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user