feat: Refactor notification handling to use SystemNotificationService; remove outdated NotificationService references and update related logic

This commit is contained in:
Alexa
2026-07-12 12:47:29 +03:00
parent 35ef784bd9
commit 28b5d5525b
5 changed files with 87 additions and 25 deletions
@@ -20,7 +20,7 @@ namespace DorkNet.Server.Controllers.API.PlayerCheer;
[Authorize]
public class PlayerCheerController(
DorkNetDbContext db,
NotificationService notifications,
SystemNotificationService systemNotifications,
LevelService level) : ControllerBase
{
private long Me => this.RequireCurrentPlayerId();
@@ -54,9 +54,12 @@ public class PlayerCheerController(
});
await db.SaveChangesAsync();
await level.AwardXpAsync(target, LevelService.CheerReceivedXp, $"cheer_from:{Me}");
await notifications.NotifyAsync(target,
PushNotificationId.SubscriptionUpdateProfile,
new { Reason = "CheerReceived", From = Me, Type = type });
// Real notification: a PlayerCheer message the client renders as
// "X cheered you" (resolved from FromPlayerId), persisted to the
// recipient's notification feed. Replaces the old blank-account
// SubscriptionUpdateProfile misuse.
await systemNotifications.SendAsync(target,
SystemNotificationService.MessageType.PlayerCheer, fromPlayerId: Me);
return Ok(new { success = true, error = "" });
}