forked from xiongyuxing/tiku-backend.net
feat(saas): implement marketplace and tenant onboarding
This commit is contained in:
@@ -37,8 +37,8 @@ public sealed class PlatformAdminController(
|
||||
[HttpPost("tenants")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformTenantManage)]
|
||||
[EndpointSummary("创建平台租户")]
|
||||
[ProducesResponseType<PlatformTenantItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformTenantItem>> CreateTenant(
|
||||
[ProducesResponseType<PlatformTenantProvisioningResult>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformTenantProvisioningResult>> CreateTenant(
|
||||
CreatePlatformTenantDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -78,55 +78,6 @@ public sealed class PlatformAdminController(
|
||||
return Ok(await platformAdminService.UpsertTenantBillingProfileAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("plans")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformTenantManage)]
|
||||
[EndpointSummary("查询平台 SaaS 套餐")]
|
||||
[ProducesResponseType<PlatformPlanList>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformPlanList>> Plans(
|
||||
[FromQuery] PlatformAdminQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.GetPlansAsync(ResolveActor(), query.ToQuery(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPut("plans/{planCode}/modules")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformTenantManage)]
|
||||
[EndpointSummary("替换 SaaS 套餐模块权益")]
|
||||
[ProducesResponseType<PlatformPlanModuleEntitlements>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformPlanModuleEntitlements>> ReplacePlanModules(
|
||||
string planCode,
|
||||
ReplacePlatformPlanModulesDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.ReplacePlanModulesAsync(
|
||||
ResolveActor(), request.ToCommand(planCode), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("subscriptions")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformTenantManage)]
|
||||
[EndpointSummary("创建或调整租户订阅")]
|
||||
[ProducesResponseType<PlatformTenantSubscriptionItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformTenantSubscriptionItem>> UpsertSubscription(
|
||||
UpsertPlatformSubscriptionDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.UpsertSubscriptionAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPut("tenants/{tenantId:guid}/module-overrides/{moduleCode}")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformTenantManage)]
|
||||
[EndpointSummary("设置租户模块覆盖")]
|
||||
[ProducesResponseType<PlatformTenantModuleOverrideItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformTenantModuleOverrideItem>> UpsertTenantModuleOverride(
|
||||
Guid tenantId,
|
||||
string moduleCode,
|
||||
UpsertPlatformTenantModuleOverrideDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.UpsertTenantModuleOverrideAsync(
|
||||
ResolveActor(), request.ToCommand(tenantId, moduleCode), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("domains")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformTenantManage)]
|
||||
[EndpointSummary("查询租户域名状态")]
|
||||
@@ -215,70 +166,70 @@ public sealed class PlatformAdminController(
|
||||
return Ok(await platformAdminService.UpdateAuditAlertStatusAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("dunning-notification-channels")]
|
||||
[HttpGet("saas/dunning/channels")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformBillingNotification)]
|
||||
[EndpointSummary("查询平台催缴通知渠道")]
|
||||
[ProducesResponseType<PlatformDunningChannelList>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformDunningChannelList>> DunningChannels(
|
||||
[ProducesResponseType<PlatformBillingDunningChannelList>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformBillingDunningChannelList>> BillingDunningChannels(
|
||||
[FromQuery] PlatformAdminQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.GetDunningChannelsAsync(ResolveActor(), query.ToQuery(), cancellationToken));
|
||||
return Ok(await platformAdminService.GetBillingDunningChannelsAsync(ResolveActor(), query.ToQuery(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPut("dunning-notification-channels")]
|
||||
[HttpPut("saas/dunning/channels")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformBillingNotification)]
|
||||
[EndpointSummary("创建或更新平台催缴通知渠道")]
|
||||
[ProducesResponseType<PlatformDunningChannelItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformDunningChannelItem>> UpsertDunningChannel(
|
||||
UpsertPlatformDunningChannelDto request,
|
||||
[ProducesResponseType<PlatformBillingDunningChannelItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformBillingDunningChannelItem>> UpsertBillingDunningChannel(
|
||||
UpsertPlatformBillingDunningChannelDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.UpsertDunningChannelAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
return Ok(await platformAdminService.UpsertBillingDunningChannelAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("dunning-notification-channels/disable")]
|
||||
[HttpPost("saas/dunning/channels/disable")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformBillingNotification)]
|
||||
[EndpointSummary("禁用平台催缴通知渠道")]
|
||||
[ProducesResponseType<PlatformDunningChannelItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformDunningChannelItem>> DisableDunningChannel(
|
||||
DisablePlatformDunningChannelDto request,
|
||||
[ProducesResponseType<PlatformBillingDunningChannelItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformBillingDunningChannelItem>> DisableBillingDunningChannel(
|
||||
DisablePlatformBillingDunningChannelDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.DisableDunningChannelAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
return Ok(await platformAdminService.DisableBillingDunningChannelAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("dunning-notification-events")]
|
||||
[HttpGet("saas/dunning/events")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformBillingNotification)]
|
||||
[EndpointSummary("查询平台催缴通知事件")]
|
||||
[ProducesResponseType<PlatformDunningEventList>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformDunningEventList>> DunningEvents(
|
||||
[ProducesResponseType<PlatformBillingDunningEventList>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformBillingDunningEventList>> BillingDunningEvents(
|
||||
[FromQuery] PlatformAdminQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.GetDunningEventsAsync(ResolveActor(), query.ToQuery(), cancellationToken));
|
||||
return Ok(await platformAdminService.GetBillingDunningEventsAsync(ResolveActor(), query.ToQuery(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("dunning-notification-events/detail")]
|
||||
[HttpGet("saas/dunning/events/detail")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformBillingNotification)]
|
||||
[EndpointSummary("查询平台催缴通知事件详情")]
|
||||
[ProducesResponseType<PlatformDunningEventItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformDunningEventItem>> DunningEventDetail(
|
||||
[ProducesResponseType<PlatformBillingDunningEventItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformBillingDunningEventItem>> BillingDunningEventDetail(
|
||||
[FromQuery] Guid eventId,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.GetDunningEventDetailAsync(ResolveActor(), eventId, cancellationToken));
|
||||
return Ok(await platformAdminService.GetBillingDunningEventDetailAsync(ResolveActor(), eventId, cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("dunning-notification-events/retry")]
|
||||
[HttpPost("saas/dunning/events/retry")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformBillingNotification)]
|
||||
[EndpointSummary("重新标记平台催缴通知事件待发送")]
|
||||
[ProducesResponseType<PlatformDunningEventItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformDunningEventItem>> RetryDunningEvent(
|
||||
RetryPlatformDunningEventDto request,
|
||||
[ProducesResponseType<PlatformBillingDunningEventItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PlatformBillingDunningEventItem>> RetryBillingDunningEvent(
|
||||
RetryPlatformBillingDunningEventDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await platformAdminService.RetryDunningEventAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
return Ok(await platformAdminService.RetryBillingDunningEventAsync(ResolveActor(), request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
private PlatformAdminActor ResolveActor()
|
||||
|
||||
Reference in New Issue
Block a user