Update filterData for authors/series when added/removed

This commit is contained in:
advplyr 2023-08-18 14:40:36 -05:00
parent 7222171c5b
commit 9d7d4c6902
12 changed files with 152 additions and 13 deletions

View file

@ -221,7 +221,7 @@ module.exports = {
}))
}
const { rows: series, count } = await Database.models.series.findAndCountAll({
const { rows: series, count } = await Database.seriesModel.findAndCountAll({
where: seriesWhere,
limit,
offset: 0,
@ -291,7 +291,7 @@ module.exports = {
async getNewestAuthors(library, user, limit) {
if (library.mediaType !== 'book') return { authors: [], count: 0 }
const { rows: authors, count } = await Database.models.author.findAndCountAll({
const { rows: authors, count } = await Database.authorModel.findAndCountAll({
where: {
libraryId: library.id,
createdAt: {
@ -461,7 +461,7 @@ module.exports = {
if (book.language) data.languages.add(book.language)
}
const series = await Database.models.series.findAll({
const series = await Database.seriesModel.findAll({
where: {
libraryId: oldLibrary.id
},
@ -469,7 +469,7 @@ module.exports = {
})
series.forEach((s) => data.series.push({ id: s.id, name: s.name }))
const authors = await Database.models.author.findAll({
const authors = await Database.authorModel.findAll({
where: {
libraryId: oldLibrary.id
},

View file

@ -278,7 +278,7 @@ module.exports = {
* @returns {object} { booksToExclude, bookSeriesToInclude }
*/
async getCollapseSeriesBooksToExclude(bookFindOptions, seriesWhere) {
const allSeries = await Database.models.series.findAll({
const allSeries = await Database.seriesModel.findAll({
attributes: [
'id',
'name',
@ -642,7 +642,7 @@ module.exports = {
const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(user)
bookWhere.push(...userPermissionBookWhere.bookWhere)
const { rows: series, count } = await Database.models.series.findAndCountAll({
const { rows: series, count } = await Database.seriesModel.findAndCountAll({
where: [
{
libraryId
@ -751,7 +751,7 @@ module.exports = {
const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(user)
// Step 1: Get the first book of every series that hasnt been started yet
const seriesNotStarted = await Database.models.series.findAll({
const seriesNotStarted = await Database.seriesModel.findAll({
where: [
{
libraryId