refactor: Rename AppAuthClient model as OAuthClient

This commit is contained in:
Faruk AYDIN
2024-12-18 17:42:04 +01:00
parent 4a4628e255
commit 8c4b67e147
61 changed files with 588 additions and 571 deletions

View File

@@ -1,10 +0,0 @@
const appAuthClientSerializer = (appAuthClient) => {
return {
id: appAuthClient.id,
appConfigId: appAuthClient.appConfigId,
name: appAuthClient.name,
active: appAuthClient.active,
};
};
export default appAuthClientSerializer;

View File

@@ -1,24 +0,0 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { createAppAuthClient } from '../../test/factories/app-auth-client';
import appAuthClientSerializer from './app-auth-client';
describe('appAuthClient serializer', () => {
let appAuthClient;
beforeEach(async () => {
appAuthClient = await createAppAuthClient();
});
it('should return app auth client data', async () => {
const expectedPayload = {
id: appAuthClient.id,
appConfigId: appAuthClient.appConfigId,
name: appAuthClient.name,
active: appAuthClient.active,
};
expect(appAuthClientSerializer(appAuthClient)).toStrictEqual(
expectedPayload
);
});
});

View File

@@ -2,7 +2,7 @@ const connectionSerializer = (connection) => {
return {
id: connection.id,
key: connection.key,
appAuthClientId: connection.appAuthClientId,
oauthClientId: connection.oauthClientId,
formattedData: {
screenName: connection.formattedData.screenName,
},

View File

@@ -13,7 +13,7 @@ describe('connectionSerializer', () => {
const expectedPayload = {
id: connection.id,
key: connection.key,
appAuthClientId: connection.appAuthClientId,
oauthClientId: connection.oauthClientId,
formattedData: {
screenName: connection.formattedData.screenName,
},

View File

@@ -4,7 +4,7 @@ import permissionSerializer from './permission.js';
import adminSamlAuthProviderSerializer from './admin-saml-auth-provider.ee.js';
import samlAuthProviderSerializer from './saml-auth-provider.ee.js';
import samlAuthProviderRoleMappingSerializer from './role-mapping.ee.js';
import appAuthClientSerializer from './app-auth-client.js';
import oauthClientSerializer from './oauth-client.js';
import appConfigSerializer from './app-config.js';
import flowSerializer from './flow.js';
import stepSerializer from './step.js';
@@ -28,7 +28,7 @@ const serializers = {
AdminSamlAuthProvider: adminSamlAuthProviderSerializer,
SamlAuthProvider: samlAuthProviderSerializer,
RoleMapping: samlAuthProviderRoleMappingSerializer,
AppAuthClient: appAuthClientSerializer,
OAuthClient: oauthClientSerializer,
AppConfig: appConfigSerializer,
Flow: flowSerializer,
Step: stepSerializer,

View File

@@ -0,0 +1,10 @@
const oauthClientSerializer = (oauthClient) => {
return {
id: oauthClient.id,
appConfigId: oauthClient.appConfigId,
name: oauthClient.name,
active: oauthClient.active,
};
};
export default oauthClientSerializer;

View File

@@ -0,0 +1,22 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { createOAuthClient } from '../../test/factories/oauth-client';
import oauthClientSerializer from './oauth-client';
describe('oauthClient serializer', () => {
let oauthClient;
beforeEach(async () => {
oauthClient = await createOAuthClient();
});
it('should return oauth client data', async () => {
const expectedPayload = {
id: oauthClient.id,
appConfigId: oauthClient.appConfigId,
name: oauthClient.name,
active: oauthClient.active,
};
expect(oauthClientSerializer(oauthClient)).toStrictEqual(expectedPayload);
});
});