feat(sms): complete SmsConfig bundle export/import wiring + GetSmsConfigurationByIdAsync (S10b)
This commit is contained in:
@@ -92,6 +92,11 @@ public sealed class BundleExporter : IBundleExporter
|
||||
Sites = resolved.Sites,
|
||||
DataConnections = resolved.DataConnections,
|
||||
Instances = resolved.Instances,
|
||||
// SMS (S10b): wire the resolver's SMS config closure through the
|
||||
// aggregate. Without this the aggregate carries the empty default and the
|
||||
// bundle ships an empty smsConfigs array even when SMS configs were
|
||||
// selected — mirrors the M8 site/instance fix (review item I3).
|
||||
SmsConfigurations = resolved.SmsConfigs,
|
||||
};
|
||||
var contentDto = _entitySerializer.ToBundleContent(aggregate);
|
||||
|
||||
@@ -112,7 +117,11 @@ public sealed class BundleExporter : IBundleExporter
|
||||
// are 0 today and become correct once those waves land.
|
||||
Sites: contentDto.Sites.Count,
|
||||
DataConnections: contentDto.DataConnections.Count,
|
||||
Instances: contentDto.Instances.Count);
|
||||
Instances: contentDto.Instances.Count,
|
||||
// SMS (S10b): additive count sourced from the serialized content DTO — the
|
||||
// same array the importer reads — so the manifest summary always matches
|
||||
// the packed payload.
|
||||
SmsConfigs: contentDto.SmsConfigs.Count);
|
||||
|
||||
// 4. Build a TEMPLATE manifest. BundleSerializer.Pack re-stamps both
|
||||
// ContentHash and EncryptionMetadata against the bytes it actually
|
||||
|
||||
@@ -111,6 +111,15 @@ public sealed class DependencyResolver
|
||||
if (sm is not null) smtpConfigs[sm.Id] = sm;
|
||||
}
|
||||
|
||||
// SMS provider configs (S10b): mirror the SMTP seed exactly — resolve each
|
||||
// selected id via the by-id repository accessor; missing ids are skipped.
|
||||
var smsConfigs = new Dictionary<int, SmsConfiguration>();
|
||||
foreach (var id in selection.SmsConfigurationIds.Distinct())
|
||||
{
|
||||
var sms = await _notifications.GetSmsConfigurationByIdAsync(id, ct).ConfigureAwait(false);
|
||||
if (sms is not null) smsConfigs[sms.Id] = sms;
|
||||
}
|
||||
|
||||
// Inbound API keys are intentionally NOT resolved into the bundle: per the
|
||||
// inbound-API-key re-architecture (C4) keys are not transported between
|
||||
// environments. Only API methods travel.
|
||||
@@ -234,6 +243,7 @@ public sealed class DependencyResolver
|
||||
dbConnections.Values,
|
||||
notificationLists.Values,
|
||||
smtpConfigs.Values,
|
||||
smsConfigs.Values,
|
||||
apiMethods.Values,
|
||||
orderedSites,
|
||||
orderedDataConnections,
|
||||
@@ -256,6 +266,9 @@ public sealed class DependencyResolver
|
||||
Sites = orderedSites,
|
||||
DataConnections = orderedDataConnections,
|
||||
Instances = orderedInstances,
|
||||
// SMS (S10b): ordered by AccountSid — the natural key the importer matches
|
||||
// on, mirroring how SMTP is ordered by Host.
|
||||
SmsConfigs = smsConfigs.Values.OrderBy(s => s.AccountSid, StringComparer.Ordinal).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -549,6 +562,7 @@ public sealed class DependencyResolver
|
||||
IEnumerable<DatabaseConnectionDefinition> dbConnections,
|
||||
IEnumerable<NotificationList> notificationLists,
|
||||
IEnumerable<SmtpConfiguration> smtpConfigs,
|
||||
IEnumerable<SmsConfiguration> smsConfigs,
|
||||
IEnumerable<ApiMethod> apiMethods,
|
||||
IReadOnlyList<Site> sites,
|
||||
IReadOnlyList<DataConnection> dataConnections,
|
||||
@@ -604,6 +618,12 @@ public sealed class DependencyResolver
|
||||
{
|
||||
entries.Add(new ManifestContentEntry("SmtpConfiguration", s.Host, 1, Array.Empty<string>()));
|
||||
}
|
||||
// SMS (S10b): mirror SMTP — one manifest row per config, keyed by AccountSid
|
||||
// (the natural key the importer matches on).
|
||||
foreach (var s in smsConfigs.OrderBy(x => x.AccountSid, StringComparer.Ordinal))
|
||||
{
|
||||
entries.Add(new ManifestContentEntry("SmsConfiguration", s.AccountSid, 1, Array.Empty<string>()));
|
||||
}
|
||||
// Inbound API keys are not transported (re-arch C4) — no ApiKey manifest entries.
|
||||
foreach (var m in apiMethods.OrderBy(x => x.Name, StringComparer.Ordinal))
|
||||
{
|
||||
|
||||
@@ -56,4 +56,12 @@ public sealed record ResolvedExport(
|
||||
/// properties.
|
||||
/// </summary>
|
||||
public IReadOnlyList<Instance> Instances { get; init; } = Array.Empty<Instance>();
|
||||
|
||||
/// <summary>
|
||||
/// SMS provider configurations in the closure, ordered by
|
||||
/// <see cref="SmsConfiguration.AccountSid"/> (S10b). Mirrors
|
||||
/// <see cref="SmtpConfigs"/>; init-only with an empty default so callers that
|
||||
/// only resolve other selections keep compiling.
|
||||
/// </summary>
|
||||
public IReadOnlyList<SmsConfiguration> SmsConfigs { get; init; } = Array.Empty<SmsConfiguration>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user