mirror of
https://github.com/bitwarden/server
synced 2025-12-15 15:53:59 +00:00
[PM-17562] Add GET endpoints for event integrations (#6104)
* [PM-17562] Add GET endpoints for event integrations * Default to null for Service * Respond to PR Feedback
This commit is contained in:
@@ -18,6 +18,27 @@ public class OrganizationIntegrationConfigurationController(
|
||||
IOrganizationIntegrationRepository integrationRepository,
|
||||
IOrganizationIntegrationConfigurationRepository integrationConfigurationRepository) : Controller
|
||||
{
|
||||
[HttpGet("")]
|
||||
public async Task<List<OrganizationIntegrationConfigurationResponseModel>> GetAsync(
|
||||
Guid organizationId,
|
||||
Guid integrationId)
|
||||
{
|
||||
if (!await HasPermission(organizationId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
var integration = await integrationRepository.GetByIdAsync(integrationId);
|
||||
if (integration == null || integration.OrganizationId != organizationId)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var configurations = await integrationConfigurationRepository.GetManyByIntegrationAsync(integrationId);
|
||||
return configurations
|
||||
.Select(configuration => new OrganizationIntegrationConfigurationResponseModel(configuration))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
[HttpPost("")]
|
||||
public async Task<OrganizationIntegrationConfigurationResponseModel> CreateAsync(
|
||||
Guid organizationId,
|
||||
|
||||
@@ -19,6 +19,20 @@ public class OrganizationIntegrationController(
|
||||
ICurrentContext currentContext,
|
||||
IOrganizationIntegrationRepository integrationRepository) : Controller
|
||||
{
|
||||
[HttpGet("")]
|
||||
public async Task<List<OrganizationIntegrationResponseModel>> GetAsync(Guid organizationId)
|
||||
{
|
||||
if (!await HasPermission(organizationId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var integrations = await integrationRepository.GetManyByOrganizationAsync(organizationId);
|
||||
return integrations
|
||||
.Select(integration => new OrganizationIntegrationResponseModel(integration))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
[HttpPost("")]
|
||||
public async Task<OrganizationIntegrationResponseModel> CreateAsync(Guid organizationId, [FromBody] OrganizationIntegrationRequestModel model)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user