Skip to content
Snippets Groups Projects
Commit 4e6e943f authored by Audrey Hamelers's avatar Audrey Hamelers
Browse files

better search for deleted terms

parent 06eed5f7
No related branches found
No related tags found
1 merge request!416better search for deleted terms
......@@ -522,7 +522,7 @@ class Manuscript extends EpmcBaseModel {
return manuscripts
}
static async searchArticleIds(id, user, trx) {
static async searchArticleIds(id, user, excludeDeleted = true, trx) {
const { isAdmin, manuscriptIds } = await Manuscript.isAdmin(user)
const manuscripts = await Manuscript.query(trx)
......@@ -535,6 +535,9 @@ class Manuscript extends EpmcBaseModel {
if (!isAdmin) {
q.whereIn('id', manuscriptIds)
}
if (excludeDeleted) {
q.whereNull('deleted')
}
})
.eager('[journal, notes, organization]')
.modifyEager('notes', builder => {
......
......@@ -415,7 +415,7 @@ const Manuscript = {
}
},
findByArticleId: async (id, userId, ftp, trx) => {
findByArticleId: async (id, userId, ftp = false, trx) => {
let manuscript = null
if (id.toUpperCase().startsWith('EMS')) {
manuscript = await ManuscriptAccess.selectById(id.toUpperCase(), trx)
......@@ -425,6 +425,7 @@ const Manuscript = {
const manuscripts = await ManuscriptAccess.searchArticleIds(
searchId,
userId,
ftp,
trx,
)
manuscript = manuscripts.pop()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment