mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-08 10:21:38 +00:00
test: define large-library browse strategy contract
This commit is contained in:
parent
da490605b7
commit
1533d4146a
4 changed files with 241 additions and 0 deletions
21
server/utils/queries/libraryBrowseCount.js
Normal file
21
server/utils/queries/libraryBrowseCount.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
async function loadBrowseCount({ mode, exactCountLoader } = {}) {
|
||||
if (mode === 'skip') {
|
||||
return {
|
||||
total: null,
|
||||
isExact: false,
|
||||
isDeferred: true
|
||||
}
|
||||
}
|
||||
|
||||
const total = await exactCountLoader()
|
||||
|
||||
return {
|
||||
total,
|
||||
isExact: true,
|
||||
isDeferred: mode === 'deferred-exact'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
loadBrowseCount
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue