mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-01 03:33:13 +00:00
Complete API layer with Clean Architecture: - Application DTOs (proposals, line items, customers, users, files, audit, dashboard) - Service interfaces (IProposalService, ILineItemService, ICustomerService, IAuditService, IS3Service, IJobPublisher) - FluentValidation validators for all create requests - Infrastructure service implementations (ProposalService, LineItemService, CustomerService, AuditService, S3Service, SqsJobPublisher, ProposalNumberGenerator) - Secrets Manager connection string resolver for RDS - API controllers: Proposals (CRUD + approve/send/revise), LineItems (CRUD + bulk), Customers, Users, Files (presigned upload/download), Admin (dashboard) - Middleware: GlobalExceptionHandler (ProblemDetails), ValidationFilter (FluentValidation pipeline) - CurrentUserService (Cognito JWT claims -> User entity, auto-provisioning) - Full DI configuration in Program.cs with Lambda hosting - Role-based authorization (dispatchers, admins, sysadmins) - CORS configured for proposals.seahaven.com + localhost
23 lines
898 B
C#
23 lines
898 B
C#
using System.Text.Json;
|
|
using Amazon.SecretsManager;
|
|
using Amazon.SecretsManager.Model;
|
|
|
|
namespace ProposalSystem.Infrastructure.Services;
|
|
|
|
public static class SecretsManagerConnectionString
|
|
{
|
|
public static async Task<string> ResolveAsync(IAmazonSecretsManager client, string secretArn)
|
|
{
|
|
var response = await client.GetSecretValueAsync(new GetSecretValueRequest
|
|
{
|
|
SecretId = secretArn,
|
|
});
|
|
|
|
var secret = JsonSerializer.Deserialize<DbSecret>(response.SecretString)
|
|
?? throw new InvalidOperationException("Failed to deserialize DB secret");
|
|
|
|
return $"Host={secret.host};Port={secret.port};Database={secret.dbname};Username={secret.username};Password={secret.password};SSL Mode=Require;Trust Server Certificate=true";
|
|
}
|
|
|
|
private record DbSecret(string host, int port, string dbname, string username, string password);
|
|
}
|