2fb86a435e
ASP.NET Core 10 Razor Pages + PostgreSQL/EF Core. RTL Persian, Jalali dates, self-hosted Vazirmatn, teal/coral brand. Features: - Shift listings: browse/filter (city, district, role, type, pay), weekly Jalali calendar, detail + interest handoff, near-me distance sort - Hiring (استخدام) listings with employment type + salary range - Pattern-engine recommendations + anonymous interest tracking (visitor cookie) - Heuristic Persian listing-parser + admin queue (raw channel post → shift/job) - Phone-OTP cookie auth + visitor-history linking + profile Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
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;
|
|
|
|
[Authorize(Roles = "Admin")] // secured by the OTP-auth Admin role
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly AppDbContext _db;
|
|
public IndexModel(AppDbContext db) => _db = db;
|
|
|
|
public List<RawListing> Queue { get; private set; } = new();
|
|
public int PublishedShifts { get; private set; }
|
|
public int PublishedJobs { get; private set; }
|
|
|
|
[BindProperty] public string? SourceChannel { get; set; }
|
|
[BindProperty] public string? RawText { get; set; }
|
|
|
|
public async Task OnGetAsync() => await LoadAsync();
|
|
|
|
public async Task<IActionResult> OnPostAddAsync()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(RawText))
|
|
{
|
|
_db.RawListings.Add(new RawListing
|
|
{
|
|
SourceChannel = string.IsNullOrWhiteSpace(SourceChannel) ? "ورود دستی" : SourceChannel.Trim(),
|
|
RawText = RawText.Trim(),
|
|
Status = RawListingStatus.New,
|
|
});
|
|
await _db.SaveChangesAsync();
|
|
}
|
|
return RedirectToPage();
|
|
}
|
|
|
|
private async Task LoadAsync()
|
|
{
|
|
Queue = await _db.RawListings
|
|
.Where(r => r.Status == RawListingStatus.New)
|
|
.OrderByDescending(r => r.FetchedAt).ToListAsync();
|
|
PublishedShifts = await _db.Shifts.CountAsync(s => s.Source != ShiftSource.Direct);
|
|
PublishedJobs = await _db.JobOpenings.CountAsync();
|
|
}
|
|
}
|