using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using eprintServer.Services; using eprintServer.Responses; using eprintServer.Entities; using eprintServer.Requests; using eprintServer.Enums; [ApiController] [Route("api/[controller]")] public class TestNotificationController : ControllerBase { private readonly FirebaseNotificationService _fcmService; private readonly UserService _userService; public TestNotificationController(FirebaseNotificationService fcmService, UserService userService) { _fcmService = fcmService; _userService = userService; } [HttpPost("send")] public async Task SendTest([FromBody] string targetToken) { var sender = await _userService.FindByIdAsync(1); var myNotif = new NotificationModel { Sender = sender, SenderId = sender?.Id, // Manually set this so ToMap() isn't empty Subject = "Hello!", Content = "This is your eprint Firebase notification!", Action = Action.OFFER_EXPIRED, LogUrl = "" // Ensure this isn't null }; var result = await _fcmService.SendNotificationAsync(myNotif, targetToken); return Ok(new { message = result }); } }