-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44e9fd2
commit 7adcff2
Showing
69 changed files
with
489 additions
and
395 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace CustomerService.Application.V1 | ||
{ | ||
public struct Anchor { } | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
samples/Customer/CustomerService.Infrastructure/Extensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.AspNetCore.Mvc.ApiExplorer; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using N8T.Infrastructure; | ||
using N8T.Infrastructure.Bus; | ||
using N8T.Infrastructure.EfCore; | ||
using N8T.Infrastructure.Swagger; | ||
using N8T.Infrastructure.TransactionalOutbox; | ||
using N8T.Infrastructure.Validator; | ||
using ProductService.Infrastructure.Data; | ||
using AppCoreAnchor = ProductService.AppCore.Anchor; | ||
|
||
namespace ProductService.Infrastructure | ||
{ | ||
public static class Extensions | ||
{ | ||
private const string CorsName = "api"; | ||
private const string DbName = "postgres"; | ||
|
||
public static IServiceCollection AddCoreServices(this IServiceCollection services, | ||
IConfiguration config, IWebHostEnvironment env, Type apiType) | ||
{ | ||
services.AddCors(options => | ||
{ | ||
options.AddPolicy(CorsName, policy => | ||
{ | ||
policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod(); | ||
}); | ||
}); | ||
|
||
services.AddHttpContextAccessor(); | ||
services.AddCustomMediatR(new[] {typeof(AppCoreAnchor)}); | ||
services.AddCustomValidators(new[] {typeof(AppCoreAnchor)}); | ||
services.AddDaprClient(); | ||
services.AddControllers().AddMessageBroker(config); | ||
services.AddTransactionalOutbox(config); | ||
services.AddSwagger(apiType); | ||
|
||
services.AddPostgresDbContext<MainDbContext>( | ||
config.GetConnectionString(DbName), | ||
svc => svc.AddRepository(typeof(Repository<>))); | ||
|
||
return services; | ||
} | ||
|
||
public static IApplicationBuilder UseCoreApplication(this WebApplication app, IWebHostEnvironment env) | ||
{ | ||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
|
||
app.UseCors(CorsName); | ||
app.UseRouting(); | ||
app.UseCloudEvents(); | ||
|
||
app.UseEndpoints(endpoints => | ||
{ | ||
endpoints.MapSubscribeHandler(); | ||
endpoints.MapDefaultControllerRoute(); | ||
}); | ||
|
||
var provider = app.Services.GetService<IApiVersionDescriptionProvider>(); | ||
return app.UseSwagger(provider); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
samples/DataContracts/CoolStore.AppContracts/Dtos/CountryDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace CoolStore.AppContracts.Dtos | ||
{ | ||
public class CountryDto | ||
{ | ||
public string Name { get; set; } | ||
public Guid Id { get; set; } | ||
public DateTime Created { get; set; } | ||
public DateTime? Updated { get; set; } | ||
} | ||
} |
43 changes: 0 additions & 43 deletions
43
samples/DataContracts/CoolStore.AppContracts/Dtos/CountryMapper.g.cs
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
samples/DataContracts/CoolStore.AppContracts/Dtos/CreditCardDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
|
||
namespace CoolStore.AppContracts.Dtos | ||
{ | ||
public class CreditCardDto | ||
{ | ||
public string NameOnCard { get; set; } | ||
public string CardNumber { get; set; } | ||
public bool Active { get; set; } | ||
public DateTime Expiry { get; set; } | ||
public Guid Id { get; set; } | ||
public DateTime Created { get; set; } | ||
public DateTime? Updated { get; set; } | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
samples/DataContracts/CoolStore.AppContracts/Dtos/CustomerDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace CoolStore.AppContracts.Dtos | ||
{ | ||
public class CustomerDto | ||
{ | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
public string Email { get; set; } | ||
public decimal Balance { get; set; } | ||
public Guid CountryId { get; set; } | ||
public Guid Id { get; set; } | ||
public DateTime Created { get; set; } | ||
public DateTime? Updated { get; set; } | ||
} | ||
} |
55 changes: 0 additions & 55 deletions
55
samples/DataContracts/CoolStore.AppContracts/Dtos/CustomerMapper.g.cs
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
samples/DataContracts/CoolStore.AppContracts/Dtos/ProductCodeDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace CoolStore.AppContracts.Dtos | ||
{ | ||
public class ProductCodeDto | ||
{ | ||
public string Name { get; set; } | ||
public Guid Id { get; set; } | ||
public DateTime Created { get; set; } | ||
public DateTime? Updated { get; set; } | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
samples/DataContracts/CoolStore.AppContracts/Dtos/ProductDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace CoolStore.AppContracts.Dtos | ||
{ | ||
public class ProductDto | ||
{ | ||
public string Name { get; set; } | ||
public bool Active { get; set; } | ||
public int Quantity { get; set; } | ||
public decimal Cost { get; set; } | ||
public Guid ProductCodeId { get; set; } | ||
public ProductCodeDto Code { get; set; } | ||
public IEnumerable<ReturnDto> Returns { get; set; } | ||
public Guid Id { get; set; } | ||
public DateTime Created { get; set; } | ||
public DateTime? Updated { get; set; } | ||
} | ||
} |
Oops, something went wrong.