Applicants: auto-tags + deep search w/ highlight; never delete (archive instead)
CI/CD / CI · dotnet build (push) Successful in 2m1s
CI/CD / Deploy · hamkadr (push) Successful in 2m36s

- Tags: parser extracts cert/skill keywords (mmt, ICU/CCU, دیالیز, اتاق عمل,
  اورژانس, مسئول فنی, پروانه‌دار…) + role + city into TalentListing.Tags
  (+ migration); shown as chips on cards.
- Deep search on /Talent: «جستجوی عمیق» box does Postgres ILIKE across
  tags, description, person, area, role, city (every term must match);
  matches are highlighted with <mark> via SearchHighlight.
- Never delete: ShiftStatus.Archived + the admin «بایگانی گروهی» action now
  ARCHIVES aggregated posts (hidden from site, kept in DB) and leaves the
  raw crawl rows intact — a permanent archive for future analytics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-08 11:25:32 +03:30
parent e4dc5180ad
commit 6b657c7795
15 changed files with 1752 additions and 22 deletions
@@ -47,21 +47,24 @@ public class IngestedModel : PageModel
}
/// <summary>
/// Bulk-delete everything that was published from ingestion: the aggregated Shift/Job/Talent
/// posts on the site AND the approved (Normalized) raw items that produced them. Done in a
/// transaction; the linked raw rows are removed first since they hold FKs to the posts.
/// ARCHIVE (never delete) everything published from ingestion: the aggregated Shift/Job/Talent
/// posts are flipped to Archived (hidden from the site but kept for analytics); the raw crawl
/// rows are retained untouched as the permanent archive.
/// </summary>
public async Task<IActionResult> OnPostDeletePublishedAsync()
public async Task<IActionResult> OnPostArchivePublishedAsync()
{
await using var tx = await _db.Database.BeginTransactionAsync();
var raws = await _db.RawListings.Where(r => r.Status == RawListingStatus.Normalized).ExecuteDeleteAsync();
var shifts = await _db.Shifts.Where(s => s.Source == ShiftSource.Aggregated).ExecuteDeleteAsync();
var jobs = await _db.JobOpenings.Where(j => j.Source == ShiftSource.Aggregated).ExecuteDeleteAsync();
var talent = await _db.TalentListings.Where(t => t.Source == ShiftSource.Aggregated).ExecuteDeleteAsync();
await tx.CommitAsync();
var shifts = await _db.Shifts
.Where(s => s.Source == ShiftSource.Aggregated && s.Status != ShiftStatus.Archived)
.ExecuteUpdateAsync(u => u.SetProperty(s => s.Status, ShiftStatus.Archived));
var jobs = await _db.JobOpenings
.Where(j => j.Source == ShiftSource.Aggregated && j.Status != ShiftStatus.Archived)
.ExecuteUpdateAsync(u => u.SetProperty(j => j.Status, ShiftStatus.Archived));
var talent = await _db.TalentListings
.Where(t => t.Source == ShiftSource.Aggregated && t.Status != ShiftStatus.Archived)
.ExecuteUpdateAsync(u => u.SetProperty(t => t.Status, ShiftStatus.Archived));
string P(int n) => JalaliDate.ToPersianDigits(n.ToString());
Message = $"حذف شد: {P(shifts)} شیفت، {P(jobs)} استخدام، {P(talent)} آماده‌به‌کار و {P(raws)} آیتم جمع‌آوری.";
Message = $"بایگانی شد (از سایت پنهان، در پایگاه‌داده نگه‌داری شد): {P(shifts)} شیفت، {P(jobs)} استخدام، {P(talent)} آماده‌به‌کار.";
return RedirectToPage(new { Status });
}
}