mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add representation column to the highlight table and gql schema which is either CONTENT or FEED_CONTENT
This commit is contained in:
parent
67f54a1372
commit
6b0cefe190
7 changed files with 45 additions and 3 deletions
|
|
@ -19,6 +19,11 @@ export enum HighlightType {
|
|||
Note = 'NOTE', // to be deleted in favor of note on library item
|
||||
}
|
||||
|
||||
export enum RepresentationType {
|
||||
Content = 'CONTENT',
|
||||
FeedContent = 'FEED_CONTENT',
|
||||
}
|
||||
|
||||
@Entity({ name: 'highlight' })
|
||||
export class Highlight {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
|
|
@ -87,4 +92,10 @@ export class Highlight {
|
|||
inverseJoinColumn: { name: 'label_id' },
|
||||
})
|
||||
labels?: Label[]
|
||||
|
||||
@Column('enum', {
|
||||
enum: RepresentationType,
|
||||
default: RepresentationType.Content,
|
||||
})
|
||||
representation!: RepresentationType
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ export type CreateHighlightInput = {
|
|||
patch?: InputMaybe<Scalars['String']>;
|
||||
prefix?: InputMaybe<Scalars['String']>;
|
||||
quote?: InputMaybe<Scalars['String']>;
|
||||
representation?: InputMaybe<RepresentationType>;
|
||||
sharedAt?: InputMaybe<Scalars['Date']>;
|
||||
shortId: Scalars['String'];
|
||||
suffix?: InputMaybe<Scalars['String']>;
|
||||
|
|
@ -1024,6 +1025,7 @@ export type Highlight = {
|
|||
quote?: Maybe<Scalars['String']>;
|
||||
reactions: Array<Reaction>;
|
||||
replies: Array<HighlightReply>;
|
||||
representation: RepresentationType;
|
||||
sharedAt?: Maybe<Scalars['Date']>;
|
||||
shortId: Scalars['String'];
|
||||
suffix?: Maybe<Scalars['String']>;
|
||||
|
|
@ -1281,6 +1283,7 @@ export type MergeHighlightInput = {
|
|||
patch: Scalars['String'];
|
||||
prefix?: InputMaybe<Scalars['String']>;
|
||||
quote: Scalars['String'];
|
||||
representation?: InputMaybe<RepresentationType>;
|
||||
shortId: Scalars['ID'];
|
||||
suffix?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
|
@ -2178,6 +2181,11 @@ export enum ReportType {
|
|||
Spam = 'SPAM'
|
||||
}
|
||||
|
||||
export enum RepresentationType {
|
||||
Content = 'CONTENT',
|
||||
FeedContent = 'FEED_CONTENT'
|
||||
}
|
||||
|
||||
export type RevokeApiKeyError = {
|
||||
__typename?: 'RevokeApiKeyError';
|
||||
errorCodes: Array<RevokeApiKeyErrorCode>;
|
||||
|
|
@ -3870,6 +3878,7 @@ export type ResolversTypes = {
|
|||
ReportItemInput: ReportItemInput;
|
||||
ReportItemResult: ResolverTypeWrapper<ReportItemResult>;
|
||||
ReportType: ReportType;
|
||||
RepresentationType: RepresentationType;
|
||||
RevokeApiKeyError: ResolverTypeWrapper<RevokeApiKeyError>;
|
||||
RevokeApiKeyErrorCode: RevokeApiKeyErrorCode;
|
||||
RevokeApiKeyResult: ResolversTypes['RevokeApiKeyError'] | ResolversTypes['RevokeApiKeySuccess'];
|
||||
|
|
@ -5256,6 +5265,7 @@ export type HighlightResolvers<ContextType = ResolverContext, ParentType extends
|
|||
quote?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
reactions?: Resolver<Array<ResolversTypes['Reaction']>, ParentType, ContextType>;
|
||||
replies?: Resolver<Array<ResolversTypes['HighlightReply']>, ParentType, ContextType>;
|
||||
representation?: Resolver<ResolversTypes['RepresentationType'], ParentType, ContextType>;
|
||||
sharedAt?: Resolver<Maybe<ResolversTypes['Date']>, ParentType, ContextType>;
|
||||
shortId?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
||||
suffix?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ input CreateHighlightInput {
|
|||
patch: String
|
||||
prefix: String
|
||||
quote: String
|
||||
representation: RepresentationType
|
||||
sharedAt: Date
|
||||
shortId: String!
|
||||
suffix: String
|
||||
|
|
@ -912,6 +913,7 @@ type Highlight {
|
|||
quote: String
|
||||
reactions: [Reaction!]!
|
||||
replies: [HighlightReply!]!
|
||||
representation: RepresentationType!
|
||||
sharedAt: Date
|
||||
shortId: String!
|
||||
suffix: String
|
||||
|
|
@ -1148,6 +1150,7 @@ input MergeHighlightInput {
|
|||
patch: String!
|
||||
prefix: String
|
||||
quote: String!
|
||||
representation: RepresentationType
|
||||
shortId: ID!
|
||||
suffix: String
|
||||
}
|
||||
|
|
@ -1622,6 +1625,11 @@ enum ReportType {
|
|||
SPAM
|
||||
}
|
||||
|
||||
enum RepresentationType {
|
||||
CONTENT
|
||||
FEED_CONTENT
|
||||
}
|
||||
|
||||
type RevokeApiKeyError {
|
||||
errorCodes: [RevokeApiKeyErrorCode!]!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { DeepPartial } from 'typeorm'
|
|||
import {
|
||||
Highlight as HighlightData,
|
||||
HighlightType,
|
||||
RepresentationType,
|
||||
} from '../../entity/highlight'
|
||||
import { Label } from '../../entity/label'
|
||||
import { env } from '../../env'
|
||||
|
|
@ -34,8 +35,8 @@ import {
|
|||
updateHighlight,
|
||||
} from '../../services/highlights'
|
||||
import { analytics } from '../../utils/analytics'
|
||||
import { highlightDataToHighlight } from '../../utils/helpers'
|
||||
import { authorized } from '../../utils/gql-utils'
|
||||
import { highlightDataToHighlight } from '../../utils/helpers'
|
||||
|
||||
export const createHighlightResolver = authorized<
|
||||
CreateHighlightSuccess,
|
||||
|
|
@ -51,6 +52,7 @@ export const createHighlightResolver = authorized<
|
|||
highlightType: input.type || HighlightType.Highlight,
|
||||
highlightPositionAnchorIndex: input.highlightPositionAnchorIndex || 0,
|
||||
highlightPositionPercent: input.highlightPositionPercent || 0,
|
||||
representation: input.representation || RepresentationType.Content,
|
||||
},
|
||||
input.articleId,
|
||||
uid,
|
||||
|
|
|
|||
|
|
@ -704,6 +704,11 @@ const schema = gql`
|
|||
NOTE
|
||||
}
|
||||
|
||||
enum RepresentationType {
|
||||
CONTENT
|
||||
FEED_CONTENT
|
||||
}
|
||||
|
||||
# Highlight
|
||||
type Highlight {
|
||||
id: ID!
|
||||
|
|
@ -729,6 +734,7 @@ const schema = gql`
|
|||
type: HighlightType!
|
||||
html: String
|
||||
color: String
|
||||
representation: RepresentationType!
|
||||
}
|
||||
|
||||
input CreateHighlightInput {
|
||||
|
|
@ -746,6 +752,7 @@ const schema = gql`
|
|||
type: HighlightType
|
||||
html: String
|
||||
color: String
|
||||
representation: RepresentationType
|
||||
}
|
||||
|
||||
type CreateHighlightSuccess {
|
||||
|
|
@ -780,6 +787,7 @@ const schema = gql`
|
|||
highlightPositionAnchorIndex: Int
|
||||
html: String
|
||||
color: String
|
||||
representation: RepresentationType
|
||||
}
|
||||
|
||||
type MergeHighlightSuccess {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ BEGIN;
|
|||
ALTER TABLE omnivore.library_item RENAME COLUMN preview_content TO feed_content;
|
||||
|
||||
CREATE TYPE fetch_content_enum AS ENUM ('ALWAYS', 'NEVER', 'WHEN_EMPTY');
|
||||
|
||||
ALTER TABLE omnivore.subscriptions ADD COLUMN fetch_content_type fetch_content_enum NOT NULL DEFAULT 'ALWAYS'::fetch_content_enum;
|
||||
|
||||
CREATE TYPE representation_type AS ENUM ('CONTENT', 'FEED_CONTENT');
|
||||
ALTER TABLE omnivore.highlight ADD COLUMN representation representation_type NOT NULL DEFAULT 'CONTENT'::representation_type;
|
||||
COMMIT;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@
|
|||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE omnivore.subscriptions DROP COLUMN fetch_content_type;
|
||||
ALTER TABLE omnivore.highlight DROP COLUMN representation;
|
||||
DROP TYPE representation_type;
|
||||
|
||||
ALTER TABLE omnivore.subscriptions DROP COLUMN fetch_content_type;
|
||||
DROP TYPE fetch_content_enum;
|
||||
|
||||
ALTER TABLE omnivore.library_item RENAME COLUMN feed_content TO preview_content;
|
||||
|
|
|
|||
Loading…
Reference in a new issue