Skip to content

Commit 688b851

Browse files
committed
[PM-28370] fix defect for self-hosted metadata (#6593)
* [PM-28370] fix defect for self-hosted metadata * dotnet format
1 parent 97d9afb commit 688b851

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Bit.Api.AdminConsole.Authorization;
2+
using Bit.Api.AdminConsole.Authorization.Requirements;
3+
using Bit.Api.Billing.Attributes;
4+
using Bit.Core;
5+
using Bit.Core.AdminConsole.Entities;
6+
using Bit.Core.Billing.Organizations.Queries;
7+
using Bit.Core.Utilities;
8+
using Microsoft.AspNetCore.Authorization;
9+
using Microsoft.AspNetCore.Mvc;
10+
using Microsoft.AspNetCore.Mvc.ModelBinding;
11+
12+
namespace Bit.Api.Billing.Controllers.VNext;
13+
14+
[Authorize("Application")]
15+
[Route("organizations/{organizationId:guid}/billing/vnext/self-host")]
16+
[SelfHosted(SelfHostedOnly = true)]
17+
public class SelfHostedBillingController(
18+
IGetOrganizationMetadataQuery getOrganizationMetadataQuery) : BaseBillingController
19+
{
20+
[Authorize<MemberOrProviderRequirement>]
21+
[HttpGet("metadata")]
22+
[RequireFeature(FeatureFlagKeys.PM25379_UseNewOrganizationMetadataStructure)]
23+
[InjectOrganization]
24+
public async Task<IResult> GetMetadataAsync([BindNever] Organization organization)
25+
{
26+
var metadata = await getOrganizationMetadataQuery.Run(organization);
27+
28+
if (metadata == null)
29+
{
30+
return TypedResults.NotFound();
31+
}
32+
33+
return TypedResults.Ok(metadata);
34+
}
35+
}

0 commit comments

Comments
 (0)