add import_item_state to set integration api payload

This commit is contained in:
Hongbo Wu 2023-10-30 16:09:10 +08:00
parent a528692125
commit f6c0b2ba34
5 changed files with 38 additions and 5 deletions

View file

@ -15,10 +15,10 @@ export enum IntegrationType {
}
export enum ImportItemState {
UNREAD = 'UNREAD',
UNARCHIVED = 'UNARCHIVED',
ARCHIVED = 'ARCHIVED',
ALL = 'ALL',
Unread = 'UNREAD',
Unarchived = 'UNARCHIVED',
Archived = 'ARCHIVED',
All = 'ALL',
}
@Entity({ name: 'integrations' })

View file

@ -970,6 +970,13 @@ export type ImportFromIntegrationSuccess = {
success: Scalars['Boolean'];
};
export enum ImportItemState {
All = 'ALL',
Archived = 'ARCHIVED',
Unarchived = 'UNARCHIVED',
Unread = 'UNREAD'
}
export type Integration = {
__typename?: 'Integration';
createdAt: Scalars['Date'];
@ -2375,6 +2382,7 @@ export enum SetIntegrationErrorCode {
export type SetIntegrationInput = {
enabled: Scalars['Boolean'];
id?: InputMaybe<Scalars['ID']>;
importItemState?: InputMaybe<ImportItemState>;
name: Scalars['String'];
syncedAt?: InputMaybe<Scalars['Date']>;
token: Scalars['String'];
@ -3495,6 +3503,7 @@ export type ResolversTypes = {
ImportFromIntegrationErrorCode: ImportFromIntegrationErrorCode;
ImportFromIntegrationResult: ResolversTypes['ImportFromIntegrationError'] | ResolversTypes['ImportFromIntegrationSuccess'];
ImportFromIntegrationSuccess: ResolverTypeWrapper<ImportFromIntegrationSuccess>;
ImportItemState: ImportItemState;
Int: ResolverTypeWrapper<Scalars['Int']>;
Integration: ResolverTypeWrapper<Integration>;
IntegrationType: IntegrationType;

View file

@ -863,6 +863,13 @@ type ImportFromIntegrationSuccess {
success: Boolean!
}
enum ImportItemState {
ALL
ARCHIVED
UNARCHIVED
UNREAD
}
type Integration {
createdAt: Date!
enabled: Boolean!
@ -1834,6 +1841,7 @@ enum SetIntegrationErrorCode {
input SetIntegrationInput {
enabled: Boolean!
id: ID
importItemState: ImportItemState
name: String!
syncedAt: Date
token: String!

View file

@ -1,5 +1,9 @@
import { DeepPartial } from 'typeorm'
import { Integration, IntegrationType } from '../../entity/integration'
import {
ImportItemState,
Integration,
IntegrationType,
} from '../../entity/integration'
import { env } from '../../env'
import {
DeleteIntegrationError,
@ -47,6 +51,10 @@ export const setIntegrationResolver = authorized<
id: input.id || undefined,
type: input.type || IntegrationType.Export,
syncedAt: input.syncedAt ? new Date(input.syncedAt) : undefined,
importItemState:
input.type === IntegrationType.Import
? input.importItemState ?? ImportItemState.Unarchived // default to unarchived
: undefined,
}
if (input.id) {
// Update

View file

@ -1972,6 +1972,13 @@ const schema = gql`
ALREADY_EXISTS
}
enum ImportItemState {
UNREAD
UNARCHIVED
ARCHIVED
ALL
}
input SetIntegrationInput {
id: ID
name: String!
@ -1979,6 +1986,7 @@ const schema = gql`
token: String!
enabled: Boolean!
syncedAt: Date
importItemState: ImportItemState
}
union IntegrationsResult = IntegrationsSuccess | IntegrationsError