114 lines
3.3 KiB
C#
114 lines
3.3 KiB
C#
using TakeoutSaaS.Domain.Coupons.Entities;
|
|
|
|
namespace TakeoutSaaS.Domain.Coupons.Repositories;
|
|
|
|
/// <summary>
|
|
/// 新客有礼仓储契约。
|
|
/// </summary>
|
|
public interface INewCustomerGiftRepository
|
|
{
|
|
/// <summary>
|
|
/// 查询门店配置。
|
|
/// </summary>
|
|
Task<NewCustomerGiftSetting?> FindSettingByStoreIdAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 新增门店配置。
|
|
/// </summary>
|
|
Task AddSettingAsync(NewCustomerGiftSetting entity, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 更新门店配置。
|
|
/// </summary>
|
|
Task UpdateSettingAsync(NewCustomerGiftSetting entity, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 查询门店全部券规则。
|
|
/// </summary>
|
|
Task<IReadOnlyList<NewCustomerCouponRule>> GetCouponRulesByStoreIdAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 替换门店券规则集合。
|
|
/// </summary>
|
|
Task ReplaceCouponRulesAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
IReadOnlyCollection<NewCustomerCouponRule> entities,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 分页查询邀请记录。
|
|
/// </summary>
|
|
Task<(IReadOnlyList<NewCustomerInviteRecord> Items, int TotalCount)> GetInviteRecordsAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
int page,
|
|
int pageSize,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 新增邀请记录。
|
|
/// </summary>
|
|
Task AddInviteRecordAsync(NewCustomerInviteRecord entity, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 按业务键查询成长记录。
|
|
/// </summary>
|
|
Task<NewCustomerGrowthRecord?> FindGrowthRecordByCustomerKeyAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
string customerKey,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 新增成长记录。
|
|
/// </summary>
|
|
Task AddGrowthRecordAsync(NewCustomerGrowthRecord entity, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 更新成长记录。
|
|
/// </summary>
|
|
Task UpdateGrowthRecordAsync(NewCustomerGrowthRecord entity, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 统计时间范围内注册新客数。
|
|
/// </summary>
|
|
Task<int> CountRegisteredCustomersAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
DateTime startAt,
|
|
DateTime endAt,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 统计时间范围内礼包已领取数。
|
|
/// </summary>
|
|
Task<int> CountGiftClaimedCustomersAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
DateTime startAt,
|
|
DateTime endAt,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 统计时间范围内首单完成数。
|
|
/// </summary>
|
|
Task<int> CountFirstOrderedCustomersAsync(
|
|
long tenantId,
|
|
long storeId,
|
|
DateTime startAt,
|
|
DateTime endAt,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 持久化变更。
|
|
/// </summary>
|
|
Task SaveChangesAsync(CancellationToken cancellationToken = default);
|
|
}
|