fix(sms): S2 review — add DeleteSmsConfigurationAsync + schema/repo tests + doc nit
This commit is contained in:
@@ -124,6 +124,12 @@ public interface INotificationRepository
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
Task UpdateSmsConfigurationAsync(SmsConfiguration smsConfiguration, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Deletes an SMS configuration by ID.</summary>
|
||||
/// <param name="id">The SMS configuration ID.</param>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
Task DeleteSmsConfigurationAsync(int id, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Saves pending changes to the repository.</summary>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>The number of entities saved.</returns>
|
||||
|
||||
+1
-2
@@ -57,8 +57,7 @@ public class NotificationRecipientConfiguration : IEntityTypeConfiguration<Notif
|
||||
|
||||
public class SmsConfigurationConfiguration : IEntityTypeConfiguration<SmsConfiguration>
|
||||
{
|
||||
/// <summary>Configures the EF Core mapping for <see cref="SmsConfiguration"/>.</summary>
|
||||
/// <param name="builder">The entity type builder.</param>
|
||||
/// <inheritdoc />
|
||||
public void Configure(EntityTypeBuilder<SmsConfiguration> builder)
|
||||
{
|
||||
builder.HasKey(s => s.Id);
|
||||
|
||||
@@ -104,6 +104,13 @@ public class NotificationRepository : INotificationRepository
|
||||
public Task UpdateSmsConfigurationAsync(SmsConfiguration smsConfiguration, CancellationToken cancellationToken = default)
|
||||
{ _context.Set<SmsConfiguration>().Update(smsConfiguration); return Task.CompletedTask; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task DeleteSmsConfigurationAsync(int id, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _context.Set<SmsConfiguration>().FindAsync(new object[] { id }, cancellationToken);
|
||||
if (entity != null) _context.Set<SmsConfiguration>().Remove(entity);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
||||
=> await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
@@ -211,6 +211,10 @@ public class SiteNotificationRepository : INotificationRepository
|
||||
public Task UpdateSmsConfigurationAsync(SmsConfiguration smsConfiguration, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException("Managed via artifact deployment from Central");
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task DeleteSmsConfigurationAsync(int id, CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException("Managed via artifact deployment from Central");
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
||||
=> throw new NotSupportedException("Managed via artifact deployment from Central");
|
||||
|
||||
Reference in New Issue
Block a user