namespace MyWebLog.Data open System open System.Threading.Tasks open MyWebLog open MyWebLog.ViewModels /// 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 meta items, text, 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 : DateTime -> 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") abstract member all : unit -> 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 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 /// 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 /// 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 /// Do any required start up data checks abstract member startUp : unit -> Task