[Ingest] Full results page (all statuses) + inline quick-reject in queue
New /Admin/Ingested page lists every crawled item with its outcome, filterable by status (همه/در صف/پرچمخورده/منتشرشده/ردشده) with per-status counts and a link to the published shift or the review page. Linked from the run-history header and the admin panel nav. Plus an inline ✕رد (quick-discard) button on each queue/flagged row so admins can audit without opening the review page; full accept/reject stays on /Admin/Review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using JobsMedical.Web.Data;
|
||||
using JobsMedical.Web.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace JobsMedical.Web.Pages.Admin;
|
||||
|
||||
/// <summary>Every crawled item with its outcome (queued / published / flagged / discarded),
|
||||
/// filterable by status and source — the full audit trail of ingestion.</summary>
|
||||
[Authorize(Roles = "Admin")]
|
||||
public class IngestedModel : PageModel
|
||||
{
|
||||
private readonly AppDbContext _db;
|
||||
public IngestedModel(AppDbContext db) => _db = db;
|
||||
|
||||
public List<RawListing> Items { get; private set; } = new();
|
||||
public int Total { get; private set; }
|
||||
public Dictionary<RawListingStatus, int> Counts { get; private set; } = new();
|
||||
|
||||
[BindProperty(SupportsGet = true)] public string? Status { get; set; } // new|flagged|published|discarded|all
|
||||
[BindProperty(SupportsGet = true)] public string? Source { get; set; }
|
||||
|
||||
public async Task OnGetAsync()
|
||||
{
|
||||
Counts = await _db.RawListings.GroupBy(r => r.Status)
|
||||
.Select(g => new { g.Key, C = g.Count() }).ToDictionaryAsync(x => x.Key, x => x.C);
|
||||
|
||||
var q = _db.RawListings.AsNoTracking().AsQueryable();
|
||||
|
||||
var st = Status?.ToLowerInvariant() switch
|
||||
{
|
||||
"new" => (RawListingStatus?)RawListingStatus.New,
|
||||
"flagged" => RawListingStatus.Flagged,
|
||||
"published" => RawListingStatus.Normalized,
|
||||
"discarded" => RawListingStatus.Discarded,
|
||||
_ => null,
|
||||
};
|
||||
if (st is not null) q = q.Where(r => r.Status == st);
|
||||
if (!string.IsNullOrWhiteSpace(Source)) q = q.Where(r => r.SourceChannel.Contains(Source));
|
||||
|
||||
Total = await q.CountAsync();
|
||||
Items = await q.OrderByDescending(r => r.FetchedAt).Take(200).ToListAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user