forked from gongxuegit/tiku-backend.net
feat(saas): implement marketplace and tenant onboarding
This commit is contained in:
25
Tiku.Api/Controllers/TenantOnboardingController.cs
Normal file
25
Tiku.Api/Controllers/TenantOnboardingController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Tiku.Application.Security;
|
||||
using Tiku.Application.Tenancy;
|
||||
|
||||
namespace Tiku.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/tenant-onboarding")]
|
||||
[Authorize(Policy = BackendPermissions.TenantSettingsManage)]
|
||||
public sealed class TenantOnboardingController(
|
||||
ITenantOnboardingService onboardingService,
|
||||
ICurrentAccessContext accessContext) : ControllerBase
|
||||
{
|
||||
[HttpGet("status")]
|
||||
public async Task<TenantOnboardingStatus> Status(CancellationToken cancellationToken)
|
||||
{
|
||||
var access = await accessContext.GetAsync(cancellationToken);
|
||||
if (access.TenantId is not { } tenantId || !access.IsCurrentTenantMember)
|
||||
{
|
||||
throw new TenantExternalProviderException("Tenant onboarding access is denied.", "tenant_access_denied");
|
||||
}
|
||||
return await onboardingService.GetStatusAsync(tenantId, cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user