Skip to content

Commit b5f4a72

Browse files
committed
Test
1 parent 760ac29 commit b5f4a72

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

packages/server/api/src/app/flow-template/cloud-template.controller.ts

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import { flowTemplateService } from './flow-template.service';
1111
export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
1212
app,
1313
) => {
14-
const publicKey = system.get(AppSystemProp.FRONTEGG_PUBLIC_KEY) || '';
15-
// const connectionPageEnabled = system.getBoolean(
16-
// AppSystemProp.CLOUD_CONNECTION_PAGE_ENABLED,
17-
// );
18-
//
19-
// if (!publicKey || !connectionPageEnabled) {
20-
// logger.info(
21-
// 'Missing Frontegg configuration, disabling cloud templates API',
22-
// );
23-
// return;
24-
// }
14+
const publicKey = system.get(AppSystemProp.FRONTEGG_PUBLIC_KEY);
15+
const connectionPageEnabled = system.getBoolean(
16+
AppSystemProp.CLOUD_CONNECTION_PAGE_ENABLED,
17+
);
18+
19+
if (!publicKey || !connectionPageEnabled) {
20+
logger.info(
21+
'Missing Frontegg configuration, disabling cloud templates API',
22+
);
23+
return;
24+
}
2525

2626
// cloud templates are available on any origin
2727
app.addHook('onRequest', allowAllOriginsHookHandler);
@@ -62,22 +62,21 @@ export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
6262
},
6363
},
6464
async (request) => {
65-
return [];
66-
// const user = getVerifiedUser(request, publicKey);
67-
//
68-
// return flowTemplateService.getFlowTemplates({
69-
// search: request.query.search,
70-
// tags: request.query.tags,
71-
// services: request.query.services,
72-
// domains: request.query.domains,
73-
// blocks: request.query.blocks,
74-
// projectId: request.principal.projectId,
75-
// organizationId: request.principal.organization.id,
76-
// cloudTemplates: true,
77-
// isSample: !user,
78-
// version: request.query.version,
79-
// categories: request.query.categories,
80-
// });
65+
const user = getVerifiedUser(request, publicKey);
66+
67+
return flowTemplateService.getFlowTemplates({
68+
search: request.query.search,
69+
tags: request.query.tags,
70+
services: request.query.services,
71+
domains: request.query.domains,
72+
blocks: request.query.blocks,
73+
projectId: request.principal.projectId,
74+
organizationId: request.principal.organization.id,
75+
cloudTemplates: true,
76+
isSample: !user,
77+
version: request.query.version,
78+
categories: request.query.categories,
79+
});
8180
},
8281
);
8382

0 commit comments

Comments
 (0)