using Service.Message; namespace WebApi.Controllers; [ApiController] [Route("api/[controller]/[action]")] public class NotificationController(INotificationService notificationService) : ControllerBase { [HttpGet] public async Task> GetVapidPublicKey() { try { var key = await notificationService.GetVapidPublicKeyAsync(); return key.Ok(); } catch (Exception ex) { return ex.Message.Fail(); } } public async Task Subscribe([FromBody] PushSubscription subscription) { try { await notificationService.SubscribeAsync(subscription); return BaseResponse.Done(); } catch (Exception ex) { return ex.Message.Fail(); } } public async Task TestNotification([FromQuery] string message) { try { await notificationService.SendNotificationAsync(message); return BaseResponse.Done(); } catch (Exception ex) { return ex.Message.Fail(); } } }