refactor(web): rewrite mutation with PATCH /v1/admin/apps/:appKey/auth-clients/:appAuthClientId

This commit is contained in:
Ali BARIN
2024-08-27 16:46:10 +00:00
parent b2bda8479e
commit 09bc0bba1e
7 changed files with 40 additions and 63 deletions

View File

@@ -2,7 +2,7 @@ import appConfig from './app.js';
const corsOptions = {
origin: appConfig.webAppUrl,
methods: 'GET,HEAD,POST,DELETE',
methods: 'GET,HEAD,POST,PATCH,DELETE',
credentials: true,
optionsSuccessStatus: 200,
};

View File

@@ -12,7 +12,6 @@ import executeFlow from './mutations/execute-flow.js';
import generateAuthUrl from './mutations/generate-auth-url.js';
import registerUser from './mutations/register-user.ee.js';
import resetConnection from './mutations/reset-connection.js';
import updateAppAuthClient from './mutations/update-app-auth-client.ee.js';
import updateAppConfig from './mutations/update-app-config.ee.js';
import updateConfig from './mutations/update-config.ee.js';
import updateConnection from './mutations/update-connection.js';
@@ -45,7 +44,6 @@ const mutationResolvers = {
generateAuthUrl,
registerUser,
resetConnection,
updateAppAuthClient,
updateAppConfig,
updateConfig,
updateConnection,

View File

@@ -1,17 +0,0 @@
import AppAuthClient from '../../models/app-auth-client.js';
const updateAppAuthClient = async (_parent, params, context) => {
context.currentUser.can('update', 'App');
const { id, ...appAuthClientData } = params.input;
const appAuthClient = await AppAuthClient.query()
.findById(id)
.throwIfNotFound();
await appAuthClient.$query().patch(appAuthClientData);
return appAuthClient;
};
export default updateAppAuthClient;

View File

@@ -17,7 +17,6 @@ type Mutation {
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
registerUser(input: RegisterUserInput): User
resetConnection(input: ResetConnectionInput): Connection
updateAppAuthClient(input: UpdateAppAuthClientInput): AppAuthClient
updateAppConfig(input: UpdateAppConfigInput): AppConfig
updateConfig(input: JSONObject): JSONObject
updateConnection(input: UpdateConnectionInput): Connection
@@ -555,20 +554,6 @@ input UpdateAppConfigInput {
disabled: Boolean
}
type AppAuthClient {
id: String
appConfigId: String
name: String
active: Boolean
}
input UpdateAppAuthClientInput {
id: String
name: String
formattedAuthDefaults: JSONObject
active: Boolean
}
schema {
query: Query
mutation: Mutation