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:
@@ -328,3 +328,43 @@ public class RecordSubmissionResponse
|
||||
public int GoldEarned { get; set; }
|
||||
public int CashEarned { get; set; }
|
||||
}
|
||||
|
||||
// ==================== NOTIFICATIONS ====================
|
||||
|
||||
public class NotificationDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Message { get; set; } = string.Empty;
|
||||
public bool IsRead { get; set; }
|
||||
public long CreatedAt { get; set; } // Unix timestamp
|
||||
public long? ExpiresAt { get; set; }
|
||||
}
|
||||
|
||||
public class NotificationsResponse
|
||||
{
|
||||
public List<NotificationDto> Notifications { get; set; } = new();
|
||||
public int TotalCount { get; set; }
|
||||
public int UnreadCount { get; set; }
|
||||
}
|
||||
|
||||
public class UnreadCountResponse
|
||||
{
|
||||
public int UnreadCount { get; set; }
|
||||
}
|
||||
|
||||
public class MarkReadRequest
|
||||
{
|
||||
public string SynergyId { get; set; } = string.Empty;
|
||||
public List<int>? NotificationIds { get; set; } // null = mark all read
|
||||
}
|
||||
|
||||
public class SendNotificationRequest
|
||||
{
|
||||
public string? SynergyId { get; set; } // null = send to all players
|
||||
public string Type { get; set; } = "system";
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Message { get; set; } = string.Empty;
|
||||
public int? ExpiresInHours { get; set; } // null = never expires
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user