feat: 套餐发布状态与可见/可购开关
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TakeoutSaaS.Domain.Tenants.Entities;
|
||||
using TakeoutSaaS.Domain.Tenants.Enums;
|
||||
using TakeoutSaaS.Domain.Tenants.Repositories;
|
||||
using TakeoutSaaS.Infrastructure.App.Persistence;
|
||||
|
||||
@@ -42,6 +43,21 @@ public sealed class EfTenantPackageRepository(TakeoutAppDbContext context) : ITe
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<TenantPackage>> SearchPublicPurchasableAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
// 1. 公共可选购套餐仅返回:已发布 + 对外可见 + 允许新购 + 启用
|
||||
return await context.TenantPackages.AsNoTracking()
|
||||
.Where(x =>
|
||||
x.IsActive
|
||||
&& x.PublishStatus == TenantPackagePublishStatus.Published
|
||||
&& x.IsPublicVisible
|
||||
&& x.IsAllowNewTenantPurchase)
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenByDescending(x => x.CreatedAt)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddAsync(TenantPackage package, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user