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

Commit

Permalink
chore: audit responses. remove unused mgmt apis
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkit committed Oct 10, 2023
1 parent 0cee6d1 commit 70c0d26
Show file tree
Hide file tree
Showing 84 changed files with 667 additions and 1,717 deletions.
12 changes: 12 additions & 0 deletions apps/api/middleware/openapi.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { logger } from '@supaglue/core/lib';
import type { NextFunction, Request, Response } from 'express';
import * as OpenApiValidator from 'express-openapi-validator';
import fs from 'fs';
Expand Down Expand Up @@ -39,6 +40,17 @@ export const openapiMiddleware = (specDir: string, version = 'v2') => {
validateRequests: {
removeAdditional: true,
},
validateResponses: {
onError: (error, body, req) => {
logger.error(
{
error,
originalUrl: req.originalUrl,
},
'API reference validation error'
);
},
},
});
};

Expand Down
7 changes: 1 addition & 6 deletions apps/api/routes/mgmt/v2/customer/connection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ export default function init(app: Router): void {
req.supaglueApplication.id
);

// enrich with user_id, if we can.
// TODO remove this after users migrate to /_provider_user_id above
const [client] = await remoteService.getCrmRemoteClient(req.params.connection_id);
const { userId } = await client.getUserIdAndDetails();

return res.status(200).send(snakecaseKeys({ ...connection, userId }));
return res.status(200).send(snakecaseKeys(connection));
}
);

Expand Down
78 changes: 0 additions & 78 deletions apps/api/routes/mgmt/v2/destination/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions apps/api/routes/mgmt/v2/entity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import { Router } from 'express';

const { entityService } = getDependencyContainer();

/**
* @deprecated
*/
export default function init(app: Router): void {
const entityRouter = Router({ mergeParams: true });

Expand Down
4 changes: 0 additions & 4 deletions apps/api/routes/mgmt/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import { pinoAndSentryContextMiddleware } from '@/middleware/pino_context';
import { Router } from 'express';
import connectionSyncConfig from './connection_sync_config';
import customer from './customer';
import destination from './destination';
import entity from './entity';
import entityMapping from './entity_mapping';
import fieldMapping from './field_mapping';
import magicLink from './magic_link';
import provider from './provider';
import schema from './schema';
import sync from './sync';
import syncConfig from './sync_config';
Expand All @@ -23,8 +21,6 @@ export default function init(app: Router): void {
v2Router.use(pinoAndSentryContextMiddleware);

customer(v2Router);
destination(v2Router);
provider(v2Router);
schema(v2Router);
syncConfig(v2Router);
sync(v2Router);
Expand Down
97 changes: 0 additions & 97 deletions apps/api/routes/mgmt/v2/provider/index.ts

This file was deleted.

21 changes: 17 additions & 4 deletions docs/docs/api/v2/mgmt/create-connection.api.mdx

Large diffs are not rendered by default.

Loading

0 comments on commit 70c0d26

Please sign in to comment.