reduce sql error
This commit is contained in:
@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user