feat: add notice model, rules and service
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfin.Plugin.Herald.Notices;
|
||||
|
||||
/// <summary>
|
||||
/// Persistence for notices and acknowledgements.
|
||||
/// </summary>
|
||||
public interface INoticeStore
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all notices, oldest first.
|
||||
/// </summary>
|
||||
/// <returns>The notices.</returns>
|
||||
IReadOnlyList<Notice> GetNotices();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single notice.
|
||||
/// </summary>
|
||||
/// <param name="id">The notice id.</param>
|
||||
/// <returns>The notice, or <c>null</c>.</returns>
|
||||
Notice? GetNotice(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts or replaces a notice.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice.</param>
|
||||
void SaveNotice(Notice notice);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a notice together with its acknowledgements.
|
||||
/// </summary>
|
||||
/// <param name="id">The notice id.</param>
|
||||
/// <returns><c>true</c> if a notice was deleted.</returns>
|
||||
bool DeleteNotice(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets every acknowledgement of a user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <returns>The acknowledgements.</returns>
|
||||
IReadOnlyList<NoticeAck> GetAcksByUser(Guid userId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the acknowledgements for one revision of a notice, oldest first.
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The notice id.</param>
|
||||
/// <param name="revision">The revision.</param>
|
||||
/// <returns>The acknowledgements.</returns>
|
||||
IReadOnlyList<NoticeAck> GetAcks(Guid noticeId, int revision);
|
||||
|
||||
/// <summary>
|
||||
/// Stores an acknowledgement. An existing one for the same notice, revision and user is kept.
|
||||
/// </summary>
|
||||
/// <param name="ack">The acknowledgement.</param>
|
||||
void AddAck(NoticeAck ack);
|
||||
}
|
||||
Reference in New Issue
Block a user