mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Dont perform an extra query for isArchived
This commit is contained in:
parent
4132800d34
commit
a874482d11
2 changed files with 8 additions and 4 deletions
|
|
@ -82,6 +82,8 @@ const linkColsWithoutContent = (tx: Knex) => {
|
|||
}
|
||||
|
||||
const linkCols = (tx: Knex) => {
|
||||
console.trace('linkCols')
|
||||
|
||||
return [
|
||||
'omnivore.pages.content',
|
||||
'omnivore.pages.originalHtml',
|
||||
|
|
@ -410,6 +412,8 @@ class UserArticleModel extends DataModel<
|
|||
tx = this.kx,
|
||||
notNullField: string | null = null
|
||||
): Promise<[PartialArticle[], number] | null> {
|
||||
console.log("GETTING PAGINATED")
|
||||
|
||||
const { cursor, first, sort, query, readFilter } = args
|
||||
|
||||
const sortOrder = sort?.order === SortOrder.Ascending ? 'ASC' : 'DESC'
|
||||
|
|
@ -481,9 +485,9 @@ class UserArticleModel extends DataModel<
|
|||
.limit(limit)
|
||||
|
||||
const rows = await queryPromise
|
||||
for (const row of rows) {
|
||||
this.loader.prime(row.id, row)
|
||||
}
|
||||
// for (const row of rows) {
|
||||
// this.loader.prime(row.id, row)
|
||||
// }
|
||||
|
||||
return [rows, parseInt(totalCount as string)]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ export const functionResolvers = {
|
|||
__: unknown,
|
||||
ctx: WithDataSourcesContext & { claims: Claims }
|
||||
) {
|
||||
if (article.isArchived) return article.isArchived
|
||||
if ('isArchived' in article) return article.isArchived
|
||||
if (!ctx.claims?.uid) return false
|
||||
const userArticle = await ctx.models.userArticle.getForUser(
|
||||
ctx.claims.uid,
|
||||
|
|
|
|||
Loading…
Reference in a new issue