feat: 新增租户端商户中心聚合接口
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 40s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 40s
提供 /merchant/info 聚合查询,返回商户主体、资质、合同、员工与日志信息,满足租户端商户中心页面一次加载全部相关数据。
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using TakeoutSaaS.Application.App.Merchants.Dto;
|
||||
using TakeoutSaaS.Application.App.Merchants.Queries;
|
||||
using TakeoutSaaS.Shared.Abstractions.Results;
|
||||
using TakeoutSaaS.Shared.Web.Api;
|
||||
|
||||
namespace TakeoutSaaS.TenantApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 租户端商户中心。
|
||||
/// </summary>
|
||||
[ApiVersion("1.0")]
|
||||
[Authorize]
|
||||
[Route("api/tenant/v{version:apiVersion}/merchant")]
|
||||
public sealed class MerchantController(IMediator mediator) : BaseApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取当前登录用户对应的商户中心信息。
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">取消标记。</param>
|
||||
/// <returns>商户中心聚合信息。</returns>
|
||||
[HttpGet("info")]
|
||||
[ProducesResponseType(typeof(ApiResponse<CurrentMerchantCenterDto>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ApiResponse<CurrentMerchantCenterDto>), StatusCodes.Status401Unauthorized)]
|
||||
public async Task<ApiResponse<CurrentMerchantCenterDto>> GetInfo(CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 查询当前商户中心信息
|
||||
var info = await mediator.Send(new GetCurrentMerchantCenterQuery(), cancellationToken);
|
||||
|
||||
// 2. 返回聚合信息
|
||||
return ApiResponse<CurrentMerchantCenterDto>.Ok(info);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user