chore: add documentation comments and stylecop rules
This commit is contained in:
@@ -29,7 +29,10 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[ProducesResponseType(typeof(ApiResponse<TenantDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<TenantDto>> Register([FromBody] RegisterTenantCommand command, CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 注册租户并初始化套餐
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 2. 返回注册结果
|
||||
return ApiResponse<TenantDto>.Ok(result);
|
||||
}
|
||||
|
||||
@@ -41,7 +44,10 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[ProducesResponseType(typeof(ApiResponse<PagedResult<TenantDto>>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<PagedResult<TenantDto>>> Search([FromQuery] SearchTenantsQuery query, CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 查询租户分页
|
||||
var result = await mediator.Send(query, cancellationToken);
|
||||
|
||||
// 2. 返回分页数据
|
||||
return ApiResponse<PagedResult<TenantDto>>.Ok(result);
|
||||
}
|
||||
|
||||
@@ -53,7 +59,10 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[ProducesResponseType(typeof(ApiResponse<TenantDetailDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<TenantDetailDto>> Detail(long tenantId, CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 查询租户详情
|
||||
var result = await mediator.Send(new GetTenantByIdQuery(tenantId), cancellationToken);
|
||||
|
||||
// 2. 返回租户信息
|
||||
return ApiResponse<TenantDetailDto>.Ok(result);
|
||||
}
|
||||
|
||||
@@ -68,8 +77,13 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[FromBody] SubmitTenantVerificationCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 合并路由中的租户标识
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 提交或更新认证资料
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 3. 返回认证结果
|
||||
return ApiResponse<TenantVerificationDto>.Ok(result);
|
||||
}
|
||||
|
||||
@@ -81,8 +95,13 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[ProducesResponseType(typeof(ApiResponse<TenantDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<TenantDto>> Review(long tenantId, [FromBody] ReviewTenantCommand body, CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 绑定租户标识
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 执行审核
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 3. 返回审核结果
|
||||
return ApiResponse<TenantDto>.Ok(result);
|
||||
}
|
||||
|
||||
@@ -97,7 +116,10 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[FromBody] CreateTenantSubscriptionCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 绑定租户并创建或续费订阅
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 返回订阅结果
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
return ApiResponse<TenantSubscriptionDto>.Ok(result);
|
||||
}
|
||||
@@ -114,8 +136,13 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[FromBody] ChangeTenantSubscriptionPlanCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 绑定租户与订阅标识
|
||||
var command = body with { TenantId = tenantId, TenantSubscriptionId = subscriptionId };
|
||||
|
||||
// 2. 执行升降配
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 3. 返回调整后的订阅
|
||||
return ApiResponse<TenantSubscriptionDto>.Ok(result);
|
||||
}
|
||||
|
||||
@@ -131,7 +158,10 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[FromQuery] int pageSize = 20,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
// 1. 构造审核日志查询
|
||||
var query = new GetTenantAuditLogsQuery(tenantId, page, pageSize);
|
||||
|
||||
// 2. 查询并返回分页结果
|
||||
var result = await mediator.Send(query, cancellationToken);
|
||||
return ApiResponse<PagedResult<TenantAuditLogDto>>.Ok(result);
|
||||
}
|
||||
@@ -148,7 +178,10 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
[FromBody, Required] CheckTenantQuotaCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 绑定租户标识
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 校验并占用配额
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
return ApiResponse<QuotaCheckResultDto>.Ok(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user