Fix searchReferencesBySourceCodes

This commit is contained in:
Robbie Antenesse 2020-07-28 10:53:21 -06:00
parent a4d6fc9913
commit 87786da9d4
1 changed files with 3 additions and 3 deletions

View File

@ -77,7 +77,7 @@ class SearchController {
let extraReferences = []; let extraReferences = [];
if (urisToCheck.length > 0) { if (urisToCheck.length > 0) {
// Need to figure this out // Need to figure this out
// extraReferences = await this.searchReferencesBySourceCodes(source, urisToCheck); extraReferences = await this.searchReferencesBySourceCodes(source, urisToCheck);
} }
return [ return [
...bookReferences, ...bookReferences,
@ -140,7 +140,7 @@ class SearchController {
const sourceJSONKey = `"${source}"`; // Enable searching withing JSON column. const sourceJSONKey = `"${source}"`; // Enable searching withing JSON column.
return await this.models.BookReference.findOne({ return await this.models.BookReference.findOne({
where: { where: {
source: { sources: {
[sourceJSONKey]: { // Where the object key is the source [sourceJSONKey]: { // Where the object key is the source
[Op.eq]: sourceId, [Op.eq]: sourceId,
}, },
@ -157,7 +157,7 @@ class SearchController {
return await this.models.BookReference.findAll({ return await this.models.BookReference.findAll({
where: { where: {
[Op.or]: sourceIds.map(sourceId => ({ [Op.or]: sourceIds.map(sourceId => ({
source: { sources: {
[sourceJSONKey]: sourceId, [sourceJSONKey]: sourceId,
}, },
})), })),