mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Remove unnecessary assembly, update casing, enable nullable reference types on notification DTOs.
This commit is contained in:
parent
ad1c880751
commit
558b50a094
@ -36,14 +36,14 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Endpoint for getting a user's notifications.
|
/// Endpoint for getting a user's notifications.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID">The UserID.</param>
|
/// <param name="userId">The user's ID.</param>
|
||||||
/// <param name="isRead">An optional filter by IsRead.</param>
|
/// <param name="isRead">An optional filter by IsRead.</param>
|
||||||
/// <param name="startIndex">The optional index to start at. All notifications with a lower index will be dropped from the results.</param>
|
/// <param name="startIndex">The optional index to start at. All notifications with a lower index will be dropped from the results.</param>
|
||||||
/// <param name="limit">An optional limit on the number of notifications returned.</param>
|
/// <param name="limit">An optional limit on the number of notifications returned.</param>
|
||||||
/// <returns>A read-only list of all of the user's notifications.</returns>
|
/// <returns>A read-only list of all of the user's notifications.</returns>
|
||||||
[HttpGet("{UserID}")]
|
[HttpGet("{UserID}")]
|
||||||
public IReadOnlyList<NotificationDto> GetNotifications(
|
public IReadOnlyList<NotificationDto> GetNotifications(
|
||||||
[FromRoute] string userID,
|
[FromRoute] string userId,
|
||||||
[FromQuery] bool? isRead,
|
[FromQuery] bool? isRead,
|
||||||
[FromQuery] int? startIndex,
|
[FromQuery] int? startIndex,
|
||||||
[FromQuery] int? limit)
|
[FromQuery] int? limit)
|
||||||
@ -54,11 +54,11 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Endpoint for getting a user's notification summary.
|
/// Endpoint for getting a user's notification summary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID">The userID.</param>
|
/// <param name="userId">The user's ID.</param>
|
||||||
/// <returns>Notifications summary for the user.</returns>
|
/// <returns>Notifications summary for the user.</returns>
|
||||||
[HttpGet("{UserID}/Summary")]
|
[HttpGet("{UserID}/Summary")]
|
||||||
public NotificationsSummaryDto GetNotificationsSummary(
|
public NotificationsSummaryDto GetNotificationsSummary(
|
||||||
[FromRoute] string userID)
|
[FromRoute] string userId)
|
||||||
{
|
{
|
||||||
return new NotificationsSummaryDto();
|
return new NotificationsSummaryDto();
|
||||||
}
|
}
|
||||||
@ -95,14 +95,14 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromForm] string name,
|
[FromForm] string name,
|
||||||
[FromForm] string description,
|
[FromForm] string description,
|
||||||
[FromForm] string? url,
|
[FromForm] string? url,
|
||||||
[FromForm] NotificationLevel level)
|
[FromForm] NotificationLevel? level)
|
||||||
{
|
{
|
||||||
var notification = new NotificationRequest
|
var notification = new NotificationRequest
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
Description = description,
|
Description = description,
|
||||||
Url = url,
|
Url = url,
|
||||||
Level = level,
|
Level = level ?? NotificationLevel.Normal,
|
||||||
UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(),
|
UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(),
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
};
|
};
|
||||||
@ -113,11 +113,11 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Endpoint to set notifications as read.
|
/// Endpoint to set notifications as read.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID">The userID.</param>
|
/// <param name="userId">The userID.</param>
|
||||||
/// <param name="ids">The IDs of notifications which should be set as read.</param>
|
/// <param name="ids">The IDs of notifications which should be set as read.</param>
|
||||||
[HttpPost("{UserID}/Read")]
|
[HttpPost("{UserID}/Read")]
|
||||||
public void SetRead(
|
public void SetRead(
|
||||||
[FromRoute] string userID,
|
[FromRoute] string userId,
|
||||||
[FromForm] List<string> ids)
|
[FromForm] List<string> ids)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -125,11 +125,11 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Endpoint to set notifications as unread.
|
/// Endpoint to set notifications as unread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID">The userID.</param>
|
/// <param name="userId">The userID.</param>
|
||||||
/// <param name="ids">The IDs of notifications which should be set as unread.</param>
|
/// <param name="ids">The IDs of notifications which should be set as unread.</param>
|
||||||
[HttpPost("{UserID}/Unread")]
|
[HttpPost("{UserID}/Unread")]
|
||||||
public void SetUnread(
|
public void SetUnread(
|
||||||
[FromRoute] string userID,
|
[FromRoute] string userId,
|
||||||
[FromForm] List<string> ids)
|
[FromForm] List<string> ids)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using MediaBrowser.Model.Notifications;
|
using MediaBrowser.Model.Notifications;
|
||||||
|
|
||||||
@ -24,28 +26,28 @@ namespace Jellyfin.Api.Models.NotificationDtos
|
|||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the notification has been read.
|
/// Gets or sets a value indicating whether the notification has been read. Defaults to false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsRead { get; set; }
|
public bool IsRead { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the notification's name.
|
/// Gets or sets the notification's name. Defaults to an empty string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the notification's description.
|
/// Gets or sets the notification's description. Defaults to an empty string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Description { get; set; } = string.Empty;
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the notification's URL.
|
/// Gets or sets the notification's URL. Defaults to null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Url { get; set; } = string.Empty;
|
public string? Url { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the notification level.
|
/// Gets or sets the notification level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NotificationLevel Level { get; set; }
|
public NotificationLevel? Level { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#nullable enable
|
||||||
|
|
||||||
using MediaBrowser.Model.Notifications;
|
using MediaBrowser.Model.Notifications;
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.NotificationDtos
|
namespace Jellyfin.Api.Models.NotificationDtos
|
||||||
@ -15,6 +17,6 @@ namespace Jellyfin.Api.Models.NotificationDtos
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the maximum unread notification level.
|
/// Gets or sets the maximum unread notification level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NotificationLevel MaxUnreadNotificationLevel { get; set; }
|
public NotificationLevel? MaxUnreadNotificationLevel { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ namespace Jellyfin.Server.Extensions
|
|||||||
// Clear app parts to avoid other assemblies being picked up
|
// Clear app parts to avoid other assemblies being picked up
|
||||||
.ConfigureApplicationPartManager(a => a.ApplicationParts.Clear())
|
.ConfigureApplicationPartManager(a => a.ApplicationParts.Clear())
|
||||||
.AddApplicationPart(typeof(StartupController).Assembly)
|
.AddApplicationPart(typeof(StartupController).Assembly)
|
||||||
.AddApplicationPart(typeof(NotificationsController).Assembly)
|
|
||||||
.AddControllersAsServices();
|
.AddControllersAsServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user