mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add linkId and labels in article type
This commit is contained in:
parent
8f68b60f18
commit
276205d52a
5 changed files with 19 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ type UserArticleStats = {
|
|||
}
|
||||
|
||||
const LINK_COLS = [
|
||||
'omnivore.links.id as linkId',
|
||||
'omnivore.links.userId',
|
||||
'omnivore.links.slug',
|
||||
'omnivore.links.article_url as url',
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ export type Article = {
|
|||
id: Scalars['ID'];
|
||||
image?: Maybe<Scalars['String']>;
|
||||
isArchived: Scalars['Boolean'];
|
||||
labels?: Maybe<Array<Label>>;
|
||||
linkId?: Maybe<Scalars['ID']>;
|
||||
originalArticleUrl?: Maybe<Scalars['String']>;
|
||||
originalHtml?: Maybe<Scalars['String']>;
|
||||
pageType?: Maybe<PageType>;
|
||||
|
|
@ -2387,6 +2389,8 @@ export type ArticleResolvers<ContextType = ResolverContext, ParentType extends R
|
|||
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
|
||||
image?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
isArchived?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
|
||||
labels?: Resolver<Maybe<Array<ResolversTypes['Label']>>, ParentType, ContextType>;
|
||||
linkId?: Resolver<Maybe<ResolversTypes['ID']>, ParentType, ContextType>;
|
||||
originalArticleUrl?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
originalHtml?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
pageType?: Resolver<Maybe<ResolversTypes['PageType']>, ParentType, ContextType>;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ type Article {
|
|||
id: ID!
|
||||
image: String
|
||||
isArchived: Boolean!
|
||||
labels: [Label!]
|
||||
linkId: ID
|
||||
originalArticleUrl: String
|
||||
originalHtml: String
|
||||
pageType: PageType
|
||||
|
|
|
|||
|
|
@ -79,6 +79,9 @@ import {
|
|||
generateDownloadSignedUrl,
|
||||
generateUploadFilePathName,
|
||||
} from '../utils/uploads'
|
||||
import { getRepository } from 'typeorm'
|
||||
import { Link } from '../entity/link'
|
||||
import { Label } from '../entity/label'
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
type ResultResolveType = {
|
||||
|
|
@ -425,6 +428,13 @@ export const functionResolvers = {
|
|||
ctx.models
|
||||
)
|
||||
},
|
||||
async labels(article: { linkId: string }): Promise<Label[] | undefined> {
|
||||
console.log('labels', article.linkId)
|
||||
const link = await getRepository(Link).findOne(article.linkId, {
|
||||
relations: ['labels'],
|
||||
})
|
||||
return link?.labels
|
||||
},
|
||||
},
|
||||
ArticleSavingRequest: {
|
||||
async article(
|
||||
|
|
|
|||
|
|
@ -333,6 +333,8 @@ const schema = gql`
|
|||
highlights(input: ArticleHighlightsInput): [Highlight!]!
|
||||
shareInfo: LinkShareInfo
|
||||
isArchived: Boolean!
|
||||
linkId: ID
|
||||
labels: [Label!]
|
||||
}
|
||||
|
||||
# Query: article
|
||||
|
|
|
|||
Loading…
Reference in a new issue