Notify matching users when a new shift/job is posted (in-app notifications)
- Notification entity + NotificationService: on publish, notify users whose saved prefs match the listing (role/city/+shift type); users with no preference aren't spammed - Wired into PostShift, PostJob, and Admin Review publish - 🔔 bell with unread count in the header (@inject) + /Me/Notifications page (mark-all-read on open) - Reliable in-app delivery (works in Iran without FCM); Web Push can ride the same records later - Verified: employee pref → employer posts matching shift → employee bell=۱ + 'شیفت جدید: پزشک عمومی' Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
@using System.Security.Claims
|
||||
@inject JobsMedical.Web.Services.NotificationService Notifications
|
||||
@{
|
||||
var title = ViewData["Title"] as string;
|
||||
int unreadCount = 0;
|
||||
if (User.Identity?.IsAuthenticated == true && int.TryParse(User.FindFirstValue(ClaimTypes.NameIdentifier), out var _uid))
|
||||
{
|
||||
unreadCount = await Notifications.UnreadCountAsync(_uid);
|
||||
}
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa" dir="rtl">
|
||||
@@ -49,6 +56,7 @@
|
||||
{
|
||||
<a asp-page="/Employer/Index" style="margin-inline-end:14px; font-weight:600;">پنل کارفرما</a>
|
||||
}
|
||||
<a asp-page="/Me/Notifications" title="اعلانها" style="margin-inline-end:12px; position:relative; font-size:18px;">🔔@if (unreadCount > 0) {<span class="bell-badge">@JalaliDate.ToPersianDigits(unreadCount > 99 ? "99+" : unreadCount.ToString())</span>}</a>
|
||||
<a asp-page="/Me/Index" style="margin-inline-end:10px; font-weight:600;">پنل کارجو</a>
|
||||
<form method="post" asp-page="/Account/Logout" style="display:inline;">
|
||||
<button type="submit" class="btn btn-outline" style="padding:7px 14px;">خروج</button>
|
||||
|
||||
Reference in New Issue
Block a user