aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/NotificationsController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-08-06 08:17:45 -0600
committercrobibero <cody@robibe.ro>2020-08-06 08:17:45 -0600
commitfffa94fc33b923863e7cfe0d57d85ae86206975e (patch)
treed5260738b85a67fa98969de0a87eeace2ae3cde2 /Jellyfin.Api/Controllers/NotificationsController.cs
parent34cf1b17574e68734e7e4394cda28f5b2a36edcf (diff)
Apply fixes from review
Diffstat (limited to 'Jellyfin.Api/Controllers/NotificationsController.cs')
-rw-r--r--Jellyfin.Api/Controllers/NotificationsController.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/Jellyfin.Api/Controllers/NotificationsController.cs b/Jellyfin.Api/Controllers/NotificationsController.cs
index 1bb39b5f7..47ce48b2d 100644
--- a/Jellyfin.Api/Controllers/NotificationsController.cs
+++ b/Jellyfin.Api/Controllers/NotificationsController.cs
@@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading;
+using Jellyfin.Api.Constants;
using Jellyfin.Api.Models.NotificationDtos;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Notifications;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -16,6 +19,7 @@ namespace Jellyfin.Api.Controllers
/// <summary>
/// The notification controller.
/// </summary>
+ [Authorize(Policy = Policies.DefaultAuthorization)]
public class NotificationsController : BaseJellyfinApiController
{
private readonly INotificationManager _notificationManager;
@@ -83,19 +87,19 @@ namespace Jellyfin.Api.Controllers
/// <summary>
/// Sends a notification to all admins.
/// </summary>
- /// <param name="name">The name of the notification.</param>
- /// <param name="description">The description of the notification.</param>
/// <param name="url">The URL of the notification.</param>
/// <param name="level">The level of the notification.</param>
+ /// <param name="name">The name of the notification.</param>
+ /// <param name="description">The description of the notification.</param>
/// <response code="204">Notification sent.</response>
/// <returns>A <cref see="NoContentResult"/>.</returns>
[HttpPost("Admin")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult CreateAdminNotification(
- [FromQuery] string? name,
- [FromQuery] string? description,
[FromQuery] string? url,
- [FromQuery] NotificationLevel? level)
+ [FromQuery] NotificationLevel? level,
+ [FromQuery, Required] string name = "",
+ [FromQuery, Required] string description = "")
{
var notification = new NotificationRequest
{