From 12e94f1ee5cd34d0dfc2db4f971d0de78fa84c06 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 18 Dec 2020 18:01:25 +0800 Subject: feat: Add bookmark timeline service interface. --- .../Timeline/Services/BookmarkTimelineService.cs | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 BackEnd/Timeline/Services/BookmarkTimelineService.cs (limited to 'BackEnd/Timeline/Services/BookmarkTimelineService.cs') diff --git a/BackEnd/Timeline/Services/BookmarkTimelineService.cs b/BackEnd/Timeline/Services/BookmarkTimelineService.cs new file mode 100644 index 00000000..7eb691b7 --- /dev/null +++ b/BackEnd/Timeline/Services/BookmarkTimelineService.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Timeline.Models; +using Timeline.Services.Exceptions; + +namespace Timeline.Services +{ + + [Serializable] + public class InvalidBookmarkException : Exception + { + public InvalidBookmarkException() { } + public InvalidBookmarkException(string message) : base(message) { } + public InvalidBookmarkException(string message, Exception inner) : base(message, inner) { } + protected InvalidBookmarkException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) : base(info, context) { } + } + + /// + /// Service interface that manages timeline bookmarks. + /// + public interface IBookmarkTimelineService + { + /// + /// Get bookmarks of a user. + /// + /// User id of bookmark owner. + /// Bookmarks in order. + /// Thrown when user does not exist. + Task> GetBookmarks(long userId); + + /// + /// Add a bookmark to tail to a user. + /// + /// User id of bookmark owner. + /// Timeline name. + /// Thrown when is null. + /// Thrown when is not a valid name. + /// Thrown when user does not exist. + /// Thrown when timeline does not exist. + Task AddBookmark(long userId, string timelineName); + + /// + /// Remove a bookmark from a user. + /// + /// User id of bookmark owner. + /// Timeline name. + /// True if deletion is performed. False if bookmark does not exist. + /// Thrown when is null. + /// Thrown when is not a valid name. + /// Thrown when user does not exist. + /// Thrown when timeline does not exist. + Task RemoveBookmark(long userId, string timelineName); + + /// + /// Move bookmark to a new position. + /// + /// User id of bookmark owner. + /// Timeline name. + /// New position. Starts at 1. + /// Thrown when is null. + /// Thrown when is not a valid name. + /// Thrown when user does not exist. + /// Thrown when timeline does not exist. + /// Thrown when the timeline is not a bookmark. + Task MoveBookmark(long userId, string timelineName, long position); + } + + public class BookmarkTimelineService + { + } +} -- cgit v1.2.3