chore: Remove old app auth clients API endpoint
This commit is contained in:
@@ -1,10 +0,0 @@
|
|||||||
import { renderObject } from '../../../../helpers/renderer.js';
|
|
||||||
import AppAuthClient from '../../../../models/app-auth-client.js';
|
|
||||||
|
|
||||||
export default async (request, response) => {
|
|
||||||
const appAuthClients = await AppAuthClient.query()
|
|
||||||
.where({ active: true })
|
|
||||||
.orderBy('created_at', 'desc');
|
|
||||||
|
|
||||||
renderObject(response, appAuthClients);
|
|
||||||
};
|
|
@@ -1,37 +0,0 @@
|
|||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
|
||||||
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 getAppAuthClientsMock from '../../../../../test/mocks/rest/api/v1/app-auth-clients/get-app-auth-clients.js';
|
|
||||||
import { createAppAuthClient } from '../../../../../test/factories/app-auth-client.js';
|
|
||||||
import * as license from '../../../../helpers/license.ee.js';
|
|
||||||
|
|
||||||
describe('GET /api/v1/app-auth-clients', () => {
|
|
||||||
let currentUser, token;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
currentUser = await createUser();
|
|
||||||
|
|
||||||
token = createAuthTokenByUserId(currentUser.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return specified app auth client info', async () => {
|
|
||||||
const appAuthClientOne = await createAppAuthClient();
|
|
||||||
const appAuthClientTwo = await createAppAuthClient();
|
|
||||||
|
|
||||||
const response = await request(app)
|
|
||||||
.get('/api/v1/app-auth-clients')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(200);
|
|
||||||
|
|
||||||
const expectedPayload = getAppAuthClientsMock([
|
|
||||||
appAuthClientTwo,
|
|
||||||
appAuthClientOne,
|
|
||||||
]);
|
|
||||||
|
|
||||||
expect(response.body).toEqual(expectedPayload);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -3,17 +3,9 @@ import asyncHandler from 'express-async-handler';
|
|||||||
import { authenticateUser } from '../../../helpers/authentication.js';
|
import { authenticateUser } from '../../../helpers/authentication.js';
|
||||||
import { checkIsEnterprise } from '../../../helpers/check-is-enterprise.js';
|
import { checkIsEnterprise } from '../../../helpers/check-is-enterprise.js';
|
||||||
import getAppAuthClientAction from '../../../controllers/api/v1/app-auth-clients/get-app-auth-client.js';
|
import getAppAuthClientAction from '../../../controllers/api/v1/app-auth-clients/get-app-auth-client.js';
|
||||||
import getAppAuthClientsAction from '../../../controllers/api/v1/app-auth-clients/get-app-auth-clients.js';
|
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get(
|
|
||||||
'/',
|
|
||||||
authenticateUser,
|
|
||||||
checkIsEnterprise,
|
|
||||||
asyncHandler(getAppAuthClientsAction)
|
|
||||||
);
|
|
||||||
|
|
||||||
router.get(
|
router.get(
|
||||||
'/:appAuthClientId',
|
'/:appAuthClientId',
|
||||||
authenticateUser,
|
authenticateUser,
|
||||||
|
Reference in New Issue
Block a user