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

Commit

Permalink
chore: revert aggregate sync event
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkit committed Dec 19, 2023
1 parent 71efd96 commit 2b0ae89
Show file tree
Hide file tree
Showing 31 changed files with 54 additions and 588 deletions.
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.

88 changes: 0 additions & 88 deletions docs/docs/api/v2/mgmt/list-sync-runs.api.mdx

This file was deleted.

Loading

0 comments on commit 2b0ae89

Please sign in to comment.