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:
@@ -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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user