Пример #1
0
        private async Task RemoveOrganizationAsync(Organization organization, JobContext context)
        {
            _logger.LogInformation("Removing organization: {Organization} ({OrganizationId})", organization.Name, organization.Id);
            await _organizationService.RemoveTokensAsync(organization).AnyContext();

            await _organizationService.RemoveWebHooksAsync(organization).AnyContext();

            await _organizationService.CancelSubscriptionsAsync(organization).AnyContext();

            await _organizationService.RemoveUsersAsync(organization, null).AnyContext();

            await RenewLockAsync(context).AnyContext();

            long removedEvents = await _eventRepository.RemoveAllByOrganizationIdAsync(organization.Id).AnyContext();

            await RenewLockAsync(context).AnyContext();

            long removedStacks = await _stackRepository.RemoveAllByOrganizationIdAsync(organization.Id).AnyContext();

            await RenewLockAsync(context).AnyContext();

            long removedProjects = await _projectRepository.RemoveAllByOrganizationIdAsync(organization.Id).AnyContext();

            await _organizationRepository.RemoveAsync(organization).AnyContext();

            _logger.LogInformation("Removed organization: {Organization} ({OrganizationId}), Removed {RemovedProjects} Projects, {RemovedStacks} Stacks, {RemovedEvents} Events", organization.Name, organization.Id, removedProjects, removedStacks, removedEvents);
        }
Пример #2
0
    private async Task RemoveOrganizationAsync(Organization organization, JobContext context)
    {
        _logger.RemoveOrganizationStart(organization.Name, organization.Id);
        await _organizationService.RemoveTokensAsync(organization).AnyContext();

        await _organizationService.RemoveWebHooksAsync(organization).AnyContext();

        await _organizationService.CancelSubscriptionsAsync(organization).AnyContext();

        await _organizationService.RemoveUsersAsync(organization, null).AnyContext();

        await RenewLockAsync(context).AnyContext();

        long removedEvents = await _eventRepository.RemoveAllByOrganizationIdAsync(organization.Id).AnyContext();

        await RenewLockAsync(context).AnyContext();

        long removedStacks = await _stackRepository.RemoveAllByOrganizationIdAsync(organization.Id).AnyContext();

        await RenewLockAsync(context).AnyContext();

        long removedProjects = await _projectRepository.RemoveAllByOrganizationIdAsync(organization.Id).AnyContext();

        await _organizationRepository.RemoveAsync(organization).AnyContext();

        _logger.RemoveOrganizationComplete(organization.Name, organization.Id, removedProjects, removedStacks, removedEvents);
    }