Merge pull request #2253 from automatisch/supports-oauth-clients
feat: Expose supportsOauthClients info for apps
This commit is contained in:
@@ -3,5 +3,5 @@ import { renderObject } from '../../../../helpers/renderer.js';
|
||||
export default async (request, response) => {
|
||||
const apps = await request.currentUser.getApps(request.query.name);
|
||||
|
||||
renderObject(response, apps, { serializer: 'App' });
|
||||
renderObject(response, apps, { serializer: 'UserApp' });
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ const appSerializer = (app) => {
|
||||
primaryColor: app.primaryColor,
|
||||
authDocUrl: app.authDocUrl,
|
||||
supportsConnections: app.supportsConnections,
|
||||
supportsOauthClients: app?.auth?.generateAuthUrl ? true : false,
|
||||
};
|
||||
|
||||
if (app.connectionCount) {
|
||||
|
||||
@@ -12,6 +12,7 @@ describe('appSerializer', () => {
|
||||
iconUrl: app.iconUrl,
|
||||
authDocUrl: app.authDocUrl,
|
||||
supportsConnections: app.supportsConnections,
|
||||
supportsOauthClients: app.auth.generateAuthUrl ? true : false,
|
||||
primaryColor: app.primaryColor,
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import flowSerializer from './flow.js';
|
||||
import stepSerializer from './step.js';
|
||||
import connectionSerializer from './connection.js';
|
||||
import appSerializer from './app.js';
|
||||
import userAppSerializer from './user-app.js';
|
||||
import authSerializer from './auth.js';
|
||||
import triggerSerializer from './trigger.js';
|
||||
import actionSerializer from './action.js';
|
||||
@@ -33,6 +34,7 @@ const serializers = {
|
||||
Step: stepSerializer,
|
||||
Connection: connectionSerializer,
|
||||
App: appSerializer,
|
||||
UserApp: userAppSerializer,
|
||||
Auth: authSerializer,
|
||||
Trigger: triggerSerializer,
|
||||
Action: actionSerializer,
|
||||
|
||||
22
packages/backend/src/serializers/user-app.js
Normal file
22
packages/backend/src/serializers/user-app.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const userAppSerializer = (userApp) => {
|
||||
let appData = {
|
||||
key: userApp.key,
|
||||
name: userApp.name,
|
||||
iconUrl: userApp.iconUrl,
|
||||
primaryColor: userApp.primaryColor,
|
||||
authDocUrl: userApp.authDocUrl,
|
||||
supportsConnections: userApp.supportsConnections,
|
||||
};
|
||||
|
||||
if (userApp.connectionCount) {
|
||||
appData.connectionCount = userApp.connectionCount;
|
||||
}
|
||||
|
||||
if (userApp.flowCount) {
|
||||
appData.flowCount = userApp.flowCount;
|
||||
}
|
||||
|
||||
return appData;
|
||||
};
|
||||
|
||||
export default userAppSerializer;
|
||||
@@ -7,6 +7,7 @@ const getAppMock = (app) => {
|
||||
name: app.name,
|
||||
primaryColor: app.primaryColor,
|
||||
supportsConnections: app.supportsConnections,
|
||||
supportsOauthClients: app.auth.generateAuthUrl ? true : false,
|
||||
},
|
||||
meta: {
|
||||
count: 1,
|
||||
|
||||
@@ -6,6 +6,7 @@ const getAppsMock = (apps) => {
|
||||
name: app.name,
|
||||
primaryColor: app.primaryColor,
|
||||
supportsConnections: app.supportsConnections,
|
||||
supportsOauthClients: app?.auth?.generateAuthUrl ? true : false,
|
||||
}));
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user