feat: Convert all query files to JS

This commit is contained in:
Faruk AYDIN
2023-12-28 13:39:31 +01:00
parent b69b1f6f67
commit 387f8fd44c
39 changed files with 151 additions and 342 deletions

View File

@@ -0,0 +1,24 @@
import { hasValidLicense } from '../../helpers/license.ee';
import Config from '../../models/config';
const getConfig = async (_parent, params) => {
if (!(await hasValidLicense())) return {};
const configQuery = Config.query();
if (Array.isArray(params.keys)) {
configQuery.whereIn('key', params.keys);
}
const config = await configQuery.orderBy('key', 'asc');
return config.reduce((computedConfig, configEntry) => {
const { key, value } = configEntry;
computedConfig[key] = value?.data;
return computedConfig;
}, {});
};
export default getConfig;