feat: write PATCH /v1/admin/config
This commit is contained in:
@@ -12,6 +12,24 @@ export const createConfig = async (params = {}) => {
|
||||
return config;
|
||||
};
|
||||
|
||||
export const createBulkConfig = async (params = {}) => {
|
||||
const updateQueries = Object.entries(params).map(([key, value]) => {
|
||||
const config = {
|
||||
key,
|
||||
value: { data: value },
|
||||
};
|
||||
|
||||
return createConfig(config);
|
||||
});
|
||||
|
||||
await Promise.all(updateQueries);
|
||||
|
||||
return await Config.query().whereIn('key', Object.keys(params));
|
||||
};
|
||||
|
||||
export const createInstallationCompletedConfig = async () => {
|
||||
return await createConfig({ key: 'installation.completed', value: { data: true } });
|
||||
}
|
||||
return await createConfig({
|
||||
key: 'installation.completed',
|
||||
value: { data: true },
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user