chore: remove update-config mutation
This commit is contained in:
@@ -11,7 +11,6 @@ import executeFlow from './mutations/execute-flow.js';
|
|||||||
import generateAuthUrl from './mutations/generate-auth-url.js';
|
import generateAuthUrl from './mutations/generate-auth-url.js';
|
||||||
import registerUser from './mutations/register-user.ee.js';
|
import registerUser from './mutations/register-user.ee.js';
|
||||||
import resetConnection from './mutations/reset-connection.js';
|
import resetConnection from './mutations/reset-connection.js';
|
||||||
import updateConfig from './mutations/update-config.ee.js';
|
|
||||||
import updateConnection from './mutations/update-connection.js';
|
import updateConnection from './mutations/update-connection.js';
|
||||||
import updateCurrentUser from './mutations/update-current-user.js';
|
import updateCurrentUser from './mutations/update-current-user.js';
|
||||||
import updateFlow from './mutations/update-flow.js';
|
import updateFlow from './mutations/update-flow.js';
|
||||||
@@ -41,7 +40,6 @@ const mutationResolvers = {
|
|||||||
generateAuthUrl,
|
generateAuthUrl,
|
||||||
registerUser,
|
registerUser,
|
||||||
resetConnection,
|
resetConnection,
|
||||||
updateConfig,
|
|
||||||
updateConnection,
|
updateConnection,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
updateFlow,
|
updateFlow,
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
import Config from '../../models/config.js';
|
|
||||||
|
|
||||||
const updateConfig = async (_parent, params, context) => {
|
|
||||||
context.currentUser.can('update', 'Config');
|
|
||||||
|
|
||||||
const config = params.input;
|
|
||||||
const configKeys = Object.keys(config);
|
|
||||||
const updates = [];
|
|
||||||
|
|
||||||
for (const key of configKeys) {
|
|
||||||
const newValue = config[key];
|
|
||||||
|
|
||||||
if (newValue) {
|
|
||||||
const entryUpdate = Config.query()
|
|
||||||
.insert({
|
|
||||||
key,
|
|
||||||
value: {
|
|
||||||
data: newValue,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.onConflict('key')
|
|
||||||
.merge({
|
|
||||||
value: {
|
|
||||||
data: newValue,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
updates.push(entryUpdate);
|
|
||||||
} else {
|
|
||||||
const entryUpdate = Config.query().findOne({ key }).delete();
|
|
||||||
updates.push(entryUpdate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all(updates);
|
|
||||||
|
|
||||||
return config;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default updateConfig;
|
|
@@ -16,7 +16,6 @@ type Mutation {
|
|||||||
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
||||||
registerUser(input: RegisterUserInput): User
|
registerUser(input: RegisterUserInput): User
|
||||||
resetConnection(input: ResetConnectionInput): Connection
|
resetConnection(input: ResetConnectionInput): Connection
|
||||||
updateConfig(input: JSONObject): JSONObject
|
|
||||||
updateConnection(input: UpdateConnectionInput): Connection
|
updateConnection(input: UpdateConnectionInput): Connection
|
||||||
updateCurrentUser(input: UpdateCurrentUserInput): User
|
updateCurrentUser(input: UpdateCurrentUserInput): User
|
||||||
updateFlow(input: UpdateFlowInput): Flow
|
updateFlow(input: UpdateFlowInput): Flow
|
||||||
|
Reference in New Issue
Block a user