Add Page Find[Full]ById tests

- Add prior permalink to a page
This commit is contained in:
2024-01-27 23:22:54 -05:00
parent 0e8044b948
commit 3f269ed3ba
8 changed files with 503 additions and 20 deletions

View File

@@ -57,15 +57,18 @@ type SQLitePageData(conn: SqliteConnection, log: ILogger) =
[ webLogParam webLogId ]
(toCount >> int)
/// Find a page by its ID (without revisions)
let findById pageId webLogId =
/// Find a page by its ID (without revisions and prior permalinks)
let findById pageId webLogId = backgroundTask {
log.LogTrace "Page.findById"
Document.findByIdAndWebLog<PageId, Page> Table.Page pageId webLogId conn
match! Document.findByIdAndWebLog<PageId, Page> Table.Page pageId webLogId conn with
| Some page -> return Some { page with PriorPermalinks = [] }
| None -> return None
}
/// Find a complete page by its ID
let findFullById pageId webLogId = backgroundTask {
log.LogTrace "Page.findFullById"
match! findById pageId webLogId with
match! Document.findByIdAndWebLog<PageId, Page> Table.Page pageId webLogId conn with
| Some page ->
let! page = appendPageRevisions page
return Some page