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:
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace JobsMedical.Web.Models;
|
||||
|
||||
/// <summary>An in-app notification for a user (e.g. a new shift/job matching their preferences).
|
||||
/// Reliable in Iran regardless of Web Push/FCM; a push can ride on top of the same records.</summary>
|
||||
public class Notification
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
[Required, MaxLength(200)] public string Title { get; set; } = "";
|
||||
[MaxLength(500)] public string? Body { get; set; }
|
||||
[MaxLength(300)] public string? Url { get; set; }
|
||||
|
||||
public bool IsRead { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user