mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
[PM-12490] Extract OrganizationService.EnableAsync into commands (#5321)
* Add organization enable command implementation * Add unit tests for OrganizationEnableCommand * Add organization enable command registration for dependency injection * Refactor payment and subscription handlers to use IOrganizationEnableCommand for organization enabling * Remove EnableAsync methods from IOrganizationService and OrganizationService * Add xmldoc to IOrganizationEnableCommand * Refactor OrganizationEnableCommand to consolidate enable logic and add optional expiration
This commit is contained in:
@ -686,18 +686,6 @@ public class OrganizationService : IOrganizationService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task EnableAsync(Guid organizationId, DateTime? expirationDate)
|
||||
{
|
||||
var org = await GetOrgById(organizationId);
|
||||
if (org != null && !org.Enabled && org.Gateway.HasValue)
|
||||
{
|
||||
org.Enabled = true;
|
||||
org.ExpirationDate = expirationDate;
|
||||
org.RevisionDate = DateTime.UtcNow;
|
||||
await ReplaceAndUpdateCacheAsync(org);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DisableAsync(Guid organizationId, DateTime? expirationDate)
|
||||
{
|
||||
var org = await GetOrgById(organizationId);
|
||||
@ -723,16 +711,6 @@ public class OrganizationService : IOrganizationService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task EnableAsync(Guid organizationId)
|
||||
{
|
||||
var org = await GetOrgById(organizationId);
|
||||
if (org != null && !org.Enabled)
|
||||
{
|
||||
org.Enabled = true;
|
||||
await ReplaceAndUpdateCacheAsync(org);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Organization organization, bool updateBilling = false, EventType eventType = EventType.Organization_Updated)
|
||||
{
|
||||
if (organization.Id == default(Guid))
|
||||
|
Reference in New Issue
Block a user