WebApi + ClientApp, GraphQL, Reflection
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace Events.FilesAPI.Infrastructure.Files;
|
||||
|
||||
public sealed class GeneratedFileReference
|
||||
{
|
||||
public string PhysicalPath { get; init; } = string.Empty;
|
||||
public string FileName { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Events.FilesAPI.Features.Certificates;
|
||||
using Events.FilesAPI.Features.RegistrationsExcel;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Events.FilesAPI.Infrastructure.Messaging;
|
||||
|
||||
public static class MassTransitSetupExtensions
|
||||
{
|
||||
public static void SetupMassTransit(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddOptions<RabbitMqSettings>()
|
||||
.Bind(configuration.GetSection("RabbitMq"))
|
||||
.ValidateDataAnnotations()
|
||||
.Validate(
|
||||
settings => Uri.TryCreate(settings.Host, UriKind.Absolute, out var uri) &&
|
||||
uri.Scheme == "rabbitmq" &&
|
||||
!string.IsNullOrWhiteSpace(uri.Host),
|
||||
"RabbitMq:Host must be a valid absolute rabbitmq:// URI.")
|
||||
.ValidateOnStart();
|
||||
|
||||
services.AddMassTransit(x =>
|
||||
{
|
||||
x.AddConsumer<CertificateRegistrationEventsConsumer>();
|
||||
x.AddConsumer<RegistrationsExcelEventsConsumer>();
|
||||
|
||||
x.UsingRabbitMq((context, cfg) =>
|
||||
{
|
||||
var settings = context.GetRequiredService<IOptions<RabbitMqSettings>>().Value;
|
||||
|
||||
cfg.Host(new Uri(settings.Host), h =>
|
||||
{
|
||||
h.Username(settings.Username);
|
||||
h.Password(settings.Password);
|
||||
});
|
||||
|
||||
cfg.ReceiveEndpoint("events-filesapi-registration-changes", e =>
|
||||
{
|
||||
e.ConfigureConsumer<CertificateRegistrationEventsConsumer>(context);
|
||||
e.ConfigureConsumer<RegistrationsExcelEventsConsumer>(context);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Events.FilesAPI.Infrastructure.Messaging;
|
||||
|
||||
public class RabbitMqSettings
|
||||
{
|
||||
[Required]
|
||||
public string Host { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Username { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Events.FilesAPI.Infrastructure.Options;
|
||||
|
||||
public class GeneratedFilesOptions
|
||||
{
|
||||
[Required]
|
||||
public string OutputPath { get; set; } = string.Empty;
|
||||
}
|
||||
Reference in New Issue
Block a user