refactor: 移除平台公告与跨租户目标
This commit is contained in:
@@ -25,10 +25,8 @@ public sealed class EfTenantAnnouncementRepository(TakeoutAppDbContext context)
|
||||
int? limit = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var tenantIds = new[] { tenantId, 0L };
|
||||
var query = context.TenantAnnouncements.AsNoTracking()
|
||||
.IgnoreQueryFilters()
|
||||
.Where(x => tenantIds.Contains(x.TenantId));
|
||||
.Where(x => x.TenantId == tenantId);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
{
|
||||
@@ -86,15 +84,6 @@ public sealed class EfTenantAnnouncementRepository(TakeoutAppDbContext context)
|
||||
return await query.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<TenantAnnouncement?> FindByIdInScopeAsync(long tenantId, long announcementId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var tenantIds = new[] { tenantId, 0L };
|
||||
return context.TenantAnnouncements.AsNoTracking()
|
||||
.IgnoreQueryFilters()
|
||||
.FirstOrDefaultAsync(x => tenantIds.Contains(x.TenantId) && x.Id == announcementId, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<TenantAnnouncement>> SearchUnreadAsync(
|
||||
long tenantId,
|
||||
@@ -104,10 +93,8 @@ public sealed class EfTenantAnnouncementRepository(TakeoutAppDbContext context)
|
||||
DateTime? effectiveAt,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var tenantIds = new[] { tenantId, 0L };
|
||||
var announcementQuery = context.TenantAnnouncements.AsNoTracking()
|
||||
.IgnoreQueryFilters()
|
||||
.Where(x => tenantIds.Contains(x.TenantId));
|
||||
.Where(x => x.TenantId == tenantId);
|
||||
|
||||
if (status.HasValue)
|
||||
{
|
||||
@@ -128,7 +115,6 @@ public sealed class EfTenantAnnouncementRepository(TakeoutAppDbContext context)
|
||||
}
|
||||
|
||||
var readQuery = context.TenantAnnouncementReads.AsNoTracking()
|
||||
.IgnoreQueryFilters()
|
||||
.Where(x => x.TenantId == tenantId);
|
||||
|
||||
readQuery = userId.HasValue
|
||||
|
||||
Reference in New Issue
Block a user