import unarchived items by default
This commit is contained in:
@ -53,7 +53,7 @@ export const setIntegrationResolver = authorized<
|
||||
syncedAt: input.syncedAt ? new Date(input.syncedAt) : undefined,
|
||||
importItemState:
|
||||
input.type === IntegrationType.Import
|
||||
? input.importItemState ?? ImportItemState.Unarchived // default to unarchived
|
||||
? input.importItemState || ImportItemState.Unarchived // default to unarchived
|
||||
: undefined,
|
||||
}
|
||||
if (input.id) {
|
||||
@ -242,7 +242,8 @@ export const importFromIntegrationResolver = authorized<
|
||||
integration.id,
|
||||
integration.name,
|
||||
integration.syncedAt?.getTime() || 0,
|
||||
authToken
|
||||
authToken,
|
||||
integration.importItemState || ImportItemState.Unarchived
|
||||
)
|
||||
// update task name in integration
|
||||
await updateIntegration(integration.id, { taskName }, uid)
|
||||
|
||||
@ -6,6 +6,7 @@ import { google } from '@google-cloud/tasks/build/protos/protos'
|
||||
import axios from 'axios'
|
||||
import { nanoid } from 'nanoid'
|
||||
import { DeepPartial } from 'typeorm'
|
||||
import { ImportItemState } from '../entity/integration'
|
||||
import { Recommendation } from '../entity/recommendation'
|
||||
import { env } from '../env'
|
||||
import {
|
||||
@ -459,13 +460,15 @@ export const enqueueImportFromIntegration = async (
|
||||
integrationId: string,
|
||||
integrationName: string,
|
||||
syncAt: number, // unix timestamp in milliseconds
|
||||
authToken: string
|
||||
authToken: string,
|
||||
state: ImportItemState
|
||||
): Promise<string> => {
|
||||
const { GOOGLE_CLOUD_PROJECT } = process.env
|
||||
const payload = {
|
||||
integrationId,
|
||||
integrationName,
|
||||
syncAt,
|
||||
state,
|
||||
}
|
||||
|
||||
const headers = {
|
||||
|
||||
@ -187,6 +187,7 @@ export const importer = Sentry.GCPFunction.wrapHttpFunction(
|
||||
let offset = 0
|
||||
let syncedAt = req.body.syncAt
|
||||
const since = syncedAt
|
||||
const state = req.body.state || State.UNARCHIVED // default to unarchived
|
||||
|
||||
console.log('importing pages from integration...')
|
||||
// get pages from integration
|
||||
@ -194,6 +195,7 @@ export const importer = Sentry.GCPFunction.wrapHttpFunction(
|
||||
token: claims.token,
|
||||
since,
|
||||
offset,
|
||||
state,
|
||||
})
|
||||
syncedAt = retrieved.since || Date.now()
|
||||
|
||||
@ -231,7 +233,7 @@ export const importer = Sentry.GCPFunction.wrapHttpFunction(
|
||||
token: claims.token,
|
||||
since,
|
||||
offset,
|
||||
state: req.body.state,
|
||||
state,
|
||||
})
|
||||
syncedAt = retrieved.since || Date.now()
|
||||
retrievedData = retrieved.data
|
||||
|
||||
@ -23,7 +23,7 @@ export interface RetrieveRequest {
|
||||
since?: number // unix timestamp in milliseconds
|
||||
count?: number
|
||||
offset?: number
|
||||
state?: State
|
||||
state: State
|
||||
}
|
||||
|
||||
export abstract class IntegrationClient {
|
||||
|
||||
@ -97,7 +97,7 @@ export class PocketClient extends IntegrationClient {
|
||||
since = 0,
|
||||
count = 100,
|
||||
offset = 0,
|
||||
state = State.UNARCHIVED,
|
||||
state,
|
||||
}: RetrieveRequest): Promise<RetrievedResult> => {
|
||||
let pocketItemState = 'all'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user