Add Notifications Service - 5 endpoints, 75/73+ complete

- NotificationsController.cs with 5 endpoints:
  * GET /synergy/notifications - list with unreadOnly filter
  * GET /synergy/notifications/unread-count - badge count
  * POST /synergy/notifications/mark-read - single or bulk
  * POST /synergy/notifications/send - player or broadcast
  * DELETE /synergy/notifications/{id} - delete by player
- Notification entity added to RR3DbContext (FK to Users, cascade delete)
- NotificationDto, NotificationsResponse, MarkReadRequest,
  SendNotificationRequest models added to ApiModels.cs
- Migration AddNotificationsTable applied
- Build: 0 errors, 0 warnings
- All 5 endpoints tested and working

Server now: 75/73 core endpoints (notifications + admin delete = 76)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-23 16:10:05 -08:00
parent 4736637c3c
commit ceeb8471bc
6 changed files with 1759 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ public class RR3DbContext : DbContext
public DbSet<Event> Events { get; set; }
public DbSet<EventCompletion> EventCompletions { get; set; }
public DbSet<EventAttempt> EventAttempts { get; set; }
public DbSet<Notification> Notifications { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -534,3 +535,19 @@ public class EventAttempt
public User? User { get; set; }
public Event? Event { get; set; }
}
// In-game notifications
public class Notification
{
public int Id { get; set; }
public int UserId { get; set; }
public string Type { get; set; } = string.Empty; // "reward", "event", "system", "friend"
public string Title { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public bool IsRead { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? ExpiresAt { get; set; }
// Navigation property
public User? User { get; set; }
}