Initial commit — Hamkadr (همکادر) healthcare-staffing marketplace

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>
This commit is contained in:
soroush.asadi
2026-06-03 01:43:55 +03:30
commit 2fb86a435e
150 changed files with 90993 additions and 0 deletions
@@ -0,0 +1,44 @@
using Microsoft.Extensions.Caching.Memory;
namespace JobsMedical.Web.Services;
/// <summary>
/// One-time-code issuing/verification. Codes live in memory for 5 minutes. In dev the code is
/// returned to the caller so it can be shown on screen; in production this is where an Iranian
/// SMS gateway (Kavenegar / SMS.ir) would send the code instead.
/// </summary>
public class OtpService
{
private readonly IMemoryCache _cache;
public OtpService(IMemoryCache cache) => _cache = cache;
private static string Key(string phone) => $"otp:{Normalize(phone)}";
/// <summary>Generate, store, and (in dev) return a 5-digit code for the phone.</summary>
public string Issue(string phone)
{
var code = Random.Shared.Next(10000, 100000).ToString();
_cache.Set(Key(phone), code, TimeSpan.FromMinutes(5));
// TODO(prod): send `code` via Kavenegar/SMS.ir instead of returning it.
return code;
}
public bool Verify(string phone, string code)
{
if (_cache.TryGetValue(Key(phone), out string? stored) && stored == code?.Trim())
{
_cache.Remove(Key(phone));
return true;
}
return false;
}
/// <summary>Normalize Iranian mobile numbers (Persian digits → Latin, strip spaces).</summary>
public static string Normalize(string phone)
{
var chars = phone.Trim().ToCharArray();
for (var i = 0; i < chars.Length; i++)
if (chars[i] >= '۰' && chars[i] <= '۹') chars[i] = (char)('0' + (chars[i] - '۰'));
return new string(chars).Replace(" ", "").Replace("-", "");
}
}