Merge pull request #1976 from omnivore-app/fix/null-pageType

Fix pageType to be null in updatesSince api response
This commit is contained in:
Hongbo Wu 2023-04-04 11:43:27 +08:00 committed by GitHub
commit 95b77b6866
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View file

@ -1,14 +1,15 @@
import { ResponseError } from '@elastic/elasticsearch/lib/errors'
import { EntityType } from '../datalayer/pubsub'
import { SortBy, SortOrder, SortParams } from '../utils/search'
import { client, INDEX_ALIAS } from './index'
import {
Highlight,
Page,
PageContext,
PageType,
SearchItem,
SearchResponse,
} from './types'
import { ResponseError } from '@elastic/elasticsearch/lib/errors'
import { client, INDEX_ALIAS } from './index'
import { SortBy, SortOrder, SortParams } from '../utils/search'
import { EntityType } from '../datalayer/pubsub'
export const addHighlightToPage = async (
id: string,
@ -241,6 +242,7 @@ export const searchHighlights = async (
...highlight,
...hit._source,
pageId: hit._id,
pageType: PageType.Highlights,
})
})
})

View file

@ -946,7 +946,7 @@ export const searchResolver = authorized<
originalArticleUrl: r.url,
publishedAt: validatedDate(r.publishedAt),
ownedByViewer: r.userId === claims.uid,
pageType: r.pageType || PageType.Highlights,
pageType: r.pageType || PageType.Unknown,
siteIcon,
} as SearchItem,
cursor: endCursor,
@ -1058,6 +1058,7 @@ export const updatesSinceResolver = authorized<
p.pageType === PageType.File
? ContentReader.Pdf
: ContentReader.Web,
pageType: p.pageType || PageType.Unknown,
} as SearchItem,
cursor: endCursor,
itemID: p.id,

View file

@ -1064,6 +1064,7 @@ describe('Article API', () => {
id
createdAt
updatedAt
pageType
}
itemID
updateReason