mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
reduce sql error
This commit is contained in:
parent
7e022e3294
commit
efd8119e02
3 changed files with 9 additions and 7 deletions
|
|
@ -180,7 +180,7 @@ export const findHighlightById = async (
|
|||
return authTrx(
|
||||
async (tx) => {
|
||||
const highlightRepo = tx.withRepository(highlightRepository)
|
||||
return highlightRepo.findOneByOrFail({
|
||||
return highlightRepo.findOneBy({
|
||||
id: highlightId,
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -187,10 +187,12 @@ export const saveLabelsInHighlight = async (
|
|||
)
|
||||
|
||||
const highlight = await findHighlightById(highlightId, userId)
|
||||
// update labels in library item
|
||||
await bulkEnqueueUpdateLabels([
|
||||
{ libraryItemId: highlight.libraryItemId, userId },
|
||||
])
|
||||
if (highlight) {
|
||||
// update labels in library item
|
||||
await bulkEnqueueUpdateLabels([
|
||||
{ libraryItemId: highlight.libraryItemId, userId },
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
export const findLabelsByIds = async (
|
||||
|
|
|
|||
|
|
@ -295,8 +295,8 @@ describe('Highlights API', () => {
|
|||
expect(res.body.data.mergeHighlight.highlight.id).to.eq(newHighlightId)
|
||||
|
||||
const highlight = await findHighlightById(newHighlightId, user.id)
|
||||
expect(highlight.labels).to.have.lengthOf(1)
|
||||
expect(highlight.labels?.[0]?.name).to.eq(labelName)
|
||||
expect(highlight?.labels).to.have.lengthOf(1)
|
||||
expect(highlight?.labels?.[0]?.name).to.eq(labelName)
|
||||
|
||||
highlightId = newHighlightId
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue