Wave/Wave/Components/Pages/Review.razor

28 lines
828 B
Plaintext

@page "/review"
@using Wave.Data
@using Microsoft.EntityFrameworkCore
@attribute [Authorize(Policy = "ArticleReviewPermissions")]
@inject IDbContextFactory<ApplicationDbContext> ContextFactory
@inject IStringLocalizer<Review> Localizer
<h1 class="text-3xl lg:text-5xl font-light mb-6 text-primary">@Localizer["Title"]</h1>
<ArticleCardList Articles="Articles" />
@code {
private List<Article> Articles { get; } = [];
protected override async Task OnInitializedAsync() {
await using var context = await ContextFactory.CreateDbContextAsync();
Articles.AddRange(await
context.Set<Article>()
.IgnoreQueryFilters()
.Include(a => a.Author)
.Include(a => a.Categories)
.Where(a => !a.IsDeleted && a.Status == ArticleStatus.InReview)
.OrderByDescending(a => a.PublishDate)
.ToListAsync());
}
}