Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

chore: revert aggregate sync event #2065

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions apps/api/routes/mgmt/v2/sync/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getDependencyContainer } from '@/dependency_container';
import { connectionHeaderMiddleware } from '@/middleware/connection';
import { BadRequestError } from '@supaglue/core/errors';
import { generateRelatedObjectSyncStates, toPaginationInternalParams } from '@supaglue/core/lib';
import { toPaginationInternalParams } from '@supaglue/core/lib';
import type {
GetSyncsPathParams,
GetSyncsQueryParams,
Expand All @@ -20,8 +20,6 @@ import type {
TriggerSyncRequest,
TriggerSyncResponse,
} from '@supaglue/schemas/v2/mgmt';
import type { ObjectSyncDTO } from '@supaglue/types/sync';
import { snakecaseKeys } from '@supaglue/utils/snakecase';
import type { Request, Response } from 'express';
import { Router } from 'express';

Expand Down Expand Up @@ -67,9 +65,7 @@ export default function init(app: Router) {
providerName: req.query?.provider_name,
});

const objectSyncs = results.filter((result) => result.type === 'object') as ObjectSyncDTO[];

const snakecaseResults = results.map((result) => {
const snakeCaseResults = results.map((result) => {
const base = {
id: result.id,
connection_id: result.connectionId,
Expand All @@ -84,20 +80,16 @@ export default function init(app: Router) {
type: 'object' as const,
object_type: result.objectType,
object: result.object,
related_sync_states: req.query?.customer_id
? snakecaseKeys(generateRelatedObjectSyncStates(objectSyncs))
: {},
};
}

return {
...base,
type: 'entity' as const,
entity_id: result.entityId,
related_sync_states: {}, // NOTE: not implementing for entity
};
});
return res.status(200).send({ next, previous, results: snakecaseResults, total_count: totalCount });
return res.status(200).send({ next, previous, results: snakeCaseResults, total_count: totalCount });
}
);

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading