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

chore: audit for responses. remove unused mgmt apis #1714

Merged
merged 2 commits into from
Oct 10, 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
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 response 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.

2 changes: 1 addition & 1 deletion docs/docs/api/v2/crm/list-list-memberships.api.mdx

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

Loading