feat: implement duplicate title normalized filter

This commit is contained in:
Tiberiu Ichim 2026-02-22 16:46:14 +02:00
parent aa85106681
commit ead215e777
13 changed files with 276 additions and 1 deletions

View file

@ -515,6 +515,10 @@ module.exports = {
isInvalid: true
}
]
} else if (filterGroup === 'duplicates') {
libraryItemWhere['titleNormalized'] = {
[Sequelize.Op.in]: Sequelize.literal(`(SELECT titleNormalized FROM libraryItems WHERE libraryId = '${libraryId}' AND titleNormalized IS NOT NULL AND titleNormalized != '' GROUP BY titleNormalized HAVING COUNT(titleNormalized) > 1)`)
}
} else if (filterGroup === 'progress' && user) {
const mediaProgressWhere = {
userId: user.id

View file

@ -168,6 +168,10 @@ module.exports = {
isInvalid: true
}
]
} else if (filterGroup === 'duplicates') {
libraryItemWhere['titleNormalized'] = {
[Sequelize.Op.in]: Sequelize.literal(`(SELECT titleNormalized FROM libraryItems WHERE libraryId = '${libraryId}' AND titleNormalized IS NOT NULL AND titleNormalized != '' GROUP BY titleNormalized HAVING COUNT(titleNormalized) > 1)`)
}
} else if (filterGroup === 'recent') {
libraryItemWhere['createdAt'] = {
[Sequelize.Op.gte]: new Date(new Date() - 60 * 24 * 60 * 60 * 1000) // 60 days ago