namespace MyWebLog.Data open System.Threading.Tasks open MyWebLog open MyWebLog.ViewModels open Newtonsoft.Json open NodaTime /// The result of a category deletion attempt [] type CategoryDeleteResult = /// The category was deleted successfully | CategoryDeleted /// The category was deleted successfully, and its children were reassigned to its parent | ReassignedChildCategories /// The category was not found, so no effort was made to delete it | CategoryNotFound /// Data functions to support manipulating categories type ICategoryData = /// Add a category abstract member Add : Category -> Task /// Count all categories for the given web log abstract member CountAll : WebLogId -> Task /// Count all top-level categories for the given web log abstract member CountTopLevel : WebLogId -> Task /// Delete a category (also removes it from posts) abstract member Delete : CategoryId -> WebLogId -> Task /// Find all categories for a web log, sorted alphabetically and grouped by hierarchy abstract member FindAllForView : WebLogId -> Task /// Find a category by its ID abstract member FindById : CategoryId -> WebLogId -> Task /// Find all categories for the given web log abstract member FindByWebLog : WebLogId -> Task /// Restore categories from a backup abstract member Restore : Category list -> Task /// Update a category (slug, name, description, and parent ID) abstract member Update : Category -> Task /// Data functions to support manipulating pages type IPageData = /// Add a page abstract member Add : Page -> Task /// Get all pages for the web log (excluding text, metadata, revisions, and prior permalinks) abstract member All : WebLogId -> Task /// Count all pages for the given web log abstract member CountAll : WebLogId -> Task /// Count pages marked as "show in page list" for the given web log abstract member CountListed : WebLogId -> Task /// Delete a page abstract member Delete : PageId -> WebLogId -> Task /// Find a page by its ID (excluding revisions and prior permalinks) abstract member FindById : PageId -> WebLogId -> Task /// Find a page by its permalink (excluding revisions and prior permalinks) abstract member FindByPermalink : Permalink -> WebLogId -> Task /// Find the current permalink for a page from a list of prior permalinks abstract member FindCurrentPermalink : Permalink list -> WebLogId -> Task /// Find a page by its ID (including revisions and prior permalinks) abstract member FindFullById : PageId -> WebLogId -> Task /// Find all pages for the given web log (including revisions and prior permalinks) abstract member FindFullByWebLog : WebLogId -> Task /// Find pages marked as "show in page list" for the given web log (excluding text, revisions, and prior permalinks) abstract member FindListed : WebLogId -> Task /// Find a page of pages (displayed in admin section) (excluding meta items, revisions and prior permalinks) abstract member FindPageOfPages : WebLogId -> pageNbr : int -> Task /// Restore pages from a backup abstract member Restore : Page list -> Task /// Update a page abstract member Update : Page -> Task /// Update the prior permalinks for the given page abstract member UpdatePriorPermalinks : PageId -> WebLogId -> Permalink list -> Task /// Data functions to support manipulating posts type IPostData = /// Add a post abstract member Add : Post -> Task /// Count posts by their status abstract member CountByStatus : PostStatus -> WebLogId -> Task /// Delete a post abstract member Delete : PostId -> WebLogId -> Task /// Find a post by its ID (excluding revisions and prior permalinks) abstract member FindById : PostId -> WebLogId -> Task /// Find a post by its permalink (excluding revisions and prior permalinks) abstract member FindByPermalink : Permalink -> WebLogId -> Task /// Find the current permalink for a post from a list of prior permalinks abstract member FindCurrentPermalink : Permalink list -> WebLogId -> Task /// Find a post by its ID (including revisions and prior permalinks) abstract member FindFullById : PostId -> WebLogId -> Task /// Find all posts for the given web log (including revisions and prior permalinks) abstract member FindFullByWebLog : WebLogId -> Task /// Find posts to be displayed on a category list page (excluding revisions and prior permalinks) abstract member FindPageOfCategorizedPosts : WebLogId -> CategoryId list -> pageNbr : int -> postsPerPage : int -> Task /// Find posts to be displayed on an admin page (excluding revisions and prior permalinks) abstract member FindPageOfPosts : WebLogId -> pageNbr : int -> postsPerPage : int -> Task /// Find posts to be displayed on a page (excluding revisions and prior permalinks) abstract member FindPageOfPublishedPosts : WebLogId -> pageNbr : int -> postsPerPage : int -> Task /// Find posts to be displayed on a tag list page (excluding revisions and prior permalinks) abstract member FindPageOfTaggedPosts : WebLogId -> tag : string -> pageNbr : int -> postsPerPage : int -> Task /// Find the next older and newer post for the given published date/time (excluding revisions and prior permalinks) abstract member FindSurroundingPosts : WebLogId -> publishedOn : Instant -> Task /// Restore posts from a backup abstract member Restore : Post list -> Task /// Update a post abstract member Update : Post -> Task /// Update the prior permalinks for a post abstract member UpdatePriorPermalinks : PostId -> WebLogId -> Permalink list -> Task /// Functions to manipulate tag mappings type ITagMapData = /// Delete a tag mapping abstract member Delete : TagMapId -> WebLogId -> Task /// Find a tag mapping by its ID abstract member FindById : TagMapId -> WebLogId -> Task /// Find a tag mapping by its URL value abstract member FindByUrlValue : string -> WebLogId -> Task /// Retrieve all tag mappings for the given web log abstract member FindByWebLog : WebLogId -> Task /// Find tag mappings for the given tags abstract member FindMappingForTags : tags : string list -> WebLogId -> Task /// Restore tag mappings from a backup abstract member Restore : TagMap list -> Task /// Save a tag mapping (insert or update) abstract member Save : TagMap -> Task /// Functions to manipulate themes type IThemeData = /// Retrieve all themes (except "admin") (excluding the text of templates) abstract member All : unit -> Task /// Delete a theme abstract member Delete : ThemeId -> Task /// Determine if a theme exists abstract member Exists : ThemeId -> Task /// Find a theme by its ID abstract member FindById : ThemeId -> Task /// Find a theme by its ID (excluding the text of its templates) abstract member FindByIdWithoutText : ThemeId -> Task /// Save a theme (insert or update) abstract member Save : Theme -> Task /// Functions to manipulate theme assets type IThemeAssetData = /// Retrieve all theme assets (excluding data) abstract member All : unit -> Task /// Delete all theme assets for the given theme abstract member DeleteByTheme : ThemeId -> Task /// Find a theme asset by its ID abstract member FindById : ThemeAssetId -> Task /// Find all assets for the given theme (excludes data) abstract member FindByTheme : ThemeId -> Task /// Find all assets for the given theme (includes data) abstract member FindByThemeWithData : ThemeId -> Task /// Save a theme asset (insert or update) abstract member Save : ThemeAsset -> Task /// Functions to manipulate uploaded files type IUploadData = /// Add an uploaded file abstract member Add : Upload -> Task /// Delete an uploaded file abstract member Delete : UploadId -> WebLogId -> Task> /// Find an uploaded file by its path for the given web log abstract member FindByPath : string -> WebLogId -> Task /// Find all uploaded files for a web log (excludes data) abstract member FindByWebLog : WebLogId -> Task /// Find all uploaded files for a web log abstract member FindByWebLogWithData : WebLogId -> Task /// Restore uploaded files from a backup abstract member Restore : Upload list -> Task /// Functions to manipulate web logs type IWebLogData = /// Add a web log abstract member Add : WebLog -> Task /// Retrieve all web logs abstract member All : unit -> Task /// Delete a web log, including categories, tag mappings, posts/comments, and pages abstract member Delete : WebLogId -> Task /// Find a web log by its host (URL base) abstract member FindByHost : string -> Task /// Find a web log by its ID abstract member FindById : WebLogId -> Task /// Update redirect rules for a web log abstract member UpdateRedirectRules : WebLog -> Task /// Update RSS options for a web log abstract member UpdateRssOptions : WebLog -> Task /// Update web log settings (from the settings page) abstract member UpdateSettings : WebLog -> Task /// Functions to manipulate web log users type IWebLogUserData = /// Add a web log user abstract member Add : WebLogUser -> Task /// Delete a web log user abstract member Delete : WebLogUserId -> WebLogId -> Task> /// Find a web log user by their e-mail address abstract member FindByEmail : email : string -> WebLogId -> Task /// Find a web log user by their ID abstract member FindById : WebLogUserId -> WebLogId -> Task /// Find all web log users for the given web log abstract member FindByWebLog : WebLogId -> Task /// Get a user ID -> name dictionary for the given user IDs abstract member FindNames : WebLogId -> WebLogUserId list -> Task /// Restore users from a backup abstract member Restore : WebLogUser list -> Task /// Set a user's last seen date/time to now abstract member SetLastSeen : WebLogUserId -> WebLogId -> Task /// Update a web log user abstract member Update : WebLogUser -> Task /// Data interface required for a myWebLog data implementation type IData = /// Category data functions abstract member Category : ICategoryData /// Page data functions abstract member Page : IPageData /// Post data functions abstract member Post : IPostData /// Tag map data functions abstract member TagMap : ITagMapData /// Theme data functions abstract member Theme : IThemeData /// Theme asset data functions abstract member ThemeAsset : IThemeAssetData /// Uploaded file functions abstract member Upload : IUploadData /// Web log data functions abstract member WebLog : IWebLogData /// Web log user data functions abstract member WebLogUser : IWebLogUserData /// A JSON serializer for use in persistence abstract member Serializer : JsonSerializer /// Do any required start up data checks abstract member StartUp : unit -> Task