feat(user-interface): introduce user interface page (#1226)

This commit is contained in:
Rıdvan Akca
2023-08-22 00:11:25 +03:00
committed by GitHub
parent 9f9ee0bb58
commit da5d594428
10 changed files with 294 additions and 42 deletions

View File

@@ -8,7 +8,11 @@ type Params = {
};
};
const updateConfig = async (_parent: unknown, params: Params, context: Context) => {
const updateConfig = async (
_parent: unknown,
params: Params,
context: Context
) => {
context.currentUser.can('update', 'Config');
const config = params.input;
@@ -18,22 +22,26 @@ const updateConfig = async (_parent: unknown, params: Params, context: Context)
for (const key of configKeys) {
const newValue = config[key];
const entryUpdate = Config
.query()
.insert({
key,
value: {
data: newValue
}
})
.onConflict('key')
.merge({
value: {
data: newValue
}
});
if (newValue) {
const entryUpdate = Config.query()
.insert({
key,
value: {
data: newValue,
},
})
.onConflict('key')
.merge({
value: {
data: newValue,
},
});
updates.push(entryUpdate);
updates.push(entryUpdate);
} else {
const entryUpdate = Config.query().findOne({ key }).delete();
updates.push(entryUpdate);
}
}
await Promise.all(updates);