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 },
|
||||
});
|
||||
};
|
||||
|
@@ -0,0 +1,26 @@
|
||||
const updateConfigMock = (
|
||||
logoConfig,
|
||||
primaryDarkConfig,
|
||||
primaryLightConfig,
|
||||
primaryMainConfig,
|
||||
titleConfig
|
||||
) => {
|
||||
return {
|
||||
data: {
|
||||
'logo.svgData': logoConfig,
|
||||
'palette.primary.dark': primaryDarkConfig,
|
||||
'palette.primary.light': primaryLightConfig,
|
||||
'palette.primary.main': primaryMainConfig,
|
||||
title: titleConfig,
|
||||
},
|
||||
meta: {
|
||||
count: 1,
|
||||
currentPage: null,
|
||||
isArray: false,
|
||||
totalPages: null,
|
||||
type: 'Object',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default updateConfigMock;
|
Reference in New Issue
Block a user