feat: 商户类目数据库化并增加权限种子

This commit is contained in:
2025-12-03 19:01:53 +08:00
parent a536a554c2
commit 0c329669a9
49 changed files with 1646 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
using System;
using System.ComponentModel.DataAnnotations;
using MediatR;
using TakeoutSaaS.Application.App.Merchants.Dto;
using TakeoutSaaS.Domain.Merchants.Enums;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 新增商户证照。
/// </summary>
public sealed record AddMerchantDocumentCommand(
[property: Required] long MerchantId,
[property: Required] MerchantDocumentType DocumentType,
[property: Required, MaxLength(512)] string FileUrl,
[property: MaxLength(64)] string? DocumentNumber,
DateTime? IssuedAt,
DateTime? ExpiresAt) : IRequest<MerchantDocumentDto>;

View File

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
using MediatR;
using TakeoutSaaS.Application.App.Merchants.Dto;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 新增商户类目。
/// </summary>
public sealed record CreateMerchantCategoryCommand(
[property: Required, MaxLength(64)] string Name,
int? DisplayOrder,
bool IsActive = true) : IRequest<MerchantCategoryDto>;

View File

@@ -0,0 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations;
using MediatR;
using TakeoutSaaS.Application.App.Merchants.Dto;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 新建商户合同。
/// </summary>
public sealed record CreateMerchantContractCommand(
[property: Required] long MerchantId,
[property: Required, MaxLength(64)] string ContractNumber,
DateTime StartDate,
DateTime EndDate,
[property: Required, MaxLength(512)] string FileUrl) : IRequest<MerchantContractDto>;

View File

@@ -0,0 +1,9 @@
using System.ComponentModel.DataAnnotations;
using MediatR;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 删除商户类目。
/// </summary>
public sealed record DeleteMerchantCategoryCommand([property: Required] long CategoryId) : IRequest<bool>;

View File

@@ -0,0 +1,18 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using MediatR;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 调整类目排序。
/// </summary>
public sealed record ReorderMerchantCategoriesCommand(
[property: Required, MinLength(1)] IReadOnlyList<MerchantCategoryOrderItem> Items) : IRequest<bool>;
/// <summary>
/// 类目排序条目。
/// </summary>
public sealed record MerchantCategoryOrderItem(
[property: Required] long CategoryId,
[property: Range(-1000, 100000)] int DisplayOrder);

View File

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
using MediatR;
using TakeoutSaaS.Application.App.Merchants.Dto;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 审核商户入驻。
/// </summary>
public sealed record ReviewMerchantCommand(
[property: Required] long MerchantId,
bool Approve,
string? Remarks) : IRequest<MerchantDto>;

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
using MediatR;
using TakeoutSaaS.Application.App.Merchants.Dto;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 审核商户证照。
/// </summary>
public sealed record ReviewMerchantDocumentCommand(
[property: Required] long MerchantId,
[property: Required] long DocumentId,
bool Approve,
string? Remarks) : IRequest<MerchantDocumentDto>;

View File

@@ -0,0 +1,17 @@
using System;
using System.ComponentModel.DataAnnotations;
using MediatR;
using TakeoutSaaS.Application.App.Merchants.Dto;
using TakeoutSaaS.Domain.Merchants.Enums;
namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 更新合同状态。
/// </summary>
public sealed record UpdateMerchantContractStatusCommand(
[property: Required] long MerchantId,
[property: Required] long ContractId,
[property: Required] ContractStatus Status,
DateTime? SignedAt,
string? Reason) : IRequest<MerchantContractDto>;