refactor: Move app config endpoint to apps namespace
This commit is contained in:
@@ -3,11 +3,11 @@ import request from 'supertest';
|
||||
import app from '../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createUser } from '../../../../../test/factories/user.js';
|
||||
import getAppConfigMock from '../../../../../test/mocks/rest/api/v1/app-configs/get-app-config.js';
|
||||
import getAppConfigMock from '../../../../../test/mocks/rest/api/v1/apps/get-config.js';
|
||||
import { createAppConfig } from '../../../../../test/factories/app-config.js';
|
||||
import * as license from '../../../../helpers/license.ee.js';
|
||||
|
||||
describe('GET /api/v1/app-configs/:appKey', () => {
|
||||
describe('GET /api/v1/apps/:appKey/config', () => {
|
||||
let currentUser, appConfig, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -27,7 +27,7 @@ describe('GET /api/v1/app-configs/:appKey', () => {
|
||||
|
||||
it('should return specified app config info', async () => {
|
||||
const response = await request(app)
|
||||
.get(`/api/v1/app-configs/${appConfig.key}`)
|
||||
.get(`/api/v1/apps/${appConfig.key}/config`)
|
||||
.set('Authorization', token)
|
||||
.expect(200);
|
||||
|
||||
@@ -37,7 +37,7 @@ describe('GET /api/v1/app-configs/:appKey', () => {
|
||||
|
||||
it('should return not found response for not existing app key', async () => {
|
||||
await request(app)
|
||||
.get('/api/v1/app-configs/not-existing-app-key')
|
||||
.get('/api/v1/apps/not-existing-app-key/config')
|
||||
.set('Authorization', token)
|
||||
.expect(404);
|
||||
});
|
@@ -1,16 +0,0 @@
|
||||
import { Router } from 'express';
|
||||
import asyncHandler from 'express-async-handler';
|
||||
import { authenticateUser } from '../../../helpers/authentication.js';
|
||||
import { checkIsEnterprise } from '../../../helpers/check-is-enterprise.js';
|
||||
import getAppConfigAction from '../../../controllers/api/v1/app-configs/get-app-config.ee.js';
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get(
|
||||
'/:appKey',
|
||||
authenticateUser,
|
||||
checkIsEnterprise,
|
||||
asyncHandler(getAppConfigAction)
|
||||
);
|
||||
|
||||
export default router;
|
@@ -2,9 +2,11 @@ import { Router } from 'express';
|
||||
import asyncHandler from 'express-async-handler';
|
||||
import { authenticateUser } from '../../../helpers/authentication.js';
|
||||
import { authorizeUser } from '../../../helpers/authorization.js';
|
||||
import { checkIsEnterprise } from '../../../helpers/check-is-enterprise.js';
|
||||
import getAppAction from '../../../controllers/api/v1/apps/get-app.js';
|
||||
import getAppsAction from '../../../controllers/api/v1/apps/get-apps.js';
|
||||
import getAuthAction from '../../../controllers/api/v1/apps/get-auth.js';
|
||||
import getConfigAction from '../../../controllers/api/v1/apps/get-config.ee.js';
|
||||
import getTriggersAction from '../../../controllers/api/v1/apps/get-triggers.js';
|
||||
import getTriggerSubstepsAction from '../../../controllers/api/v1/apps/get-trigger-substeps.js';
|
||||
import getActionsAction from '../../../controllers/api/v1/apps/get-actions.js';
|
||||
@@ -17,6 +19,13 @@ router.get('/', authenticateUser, asyncHandler(getAppsAction));
|
||||
router.get('/:appKey', authenticateUser, asyncHandler(getAppAction));
|
||||
router.get('/:appKey/auth', authenticateUser, asyncHandler(getAuthAction));
|
||||
|
||||
router.get(
|
||||
'/:appKey/config',
|
||||
authenticateUser,
|
||||
checkIsEnterprise,
|
||||
asyncHandler(getConfigAction)
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/:appKey/triggers',
|
||||
authenticateUser,
|
||||
|
@@ -7,7 +7,6 @@ import automatischRouter from './api/v1/automatisch.js';
|
||||
import usersRouter from './api/v1/users.js';
|
||||
import paymentRouter from './api/v1/payment.ee.js';
|
||||
import appAuthClientsRouter from './api/v1/app-auth-clients.js';
|
||||
import appConfigsRouter from './api/v1/app-configs.ee.js';
|
||||
import flowsRouter from './api/v1/flows.js';
|
||||
import stepsRouter from './api/v1/steps.js';
|
||||
import appsRouter from './api/v1/apps.js';
|
||||
@@ -30,7 +29,6 @@ router.use('/api/v1/automatisch', automatischRouter);
|
||||
router.use('/api/v1/users', usersRouter);
|
||||
router.use('/api/v1/payment', paymentRouter);
|
||||
router.use('/api/v1/app-auth-clients', appAuthClientsRouter);
|
||||
router.use('/api/v1/app-configs', appConfigsRouter);
|
||||
router.use('/api/v1/flows', flowsRouter);
|
||||
router.use('/api/v1/steps', stepsRouter);
|
||||
router.use('/api/v1/apps', appsRouter);
|
||||
|
Reference in New Issue
Block a user