30 lines
886 B
JavaScript
30 lines
886 B
JavaScript
import { getStore } from './store.js';
|
|
import { requireSelectedCompanyAdmin } from './companyuser.js';
|
|
|
|
export const ADMIN_ONLY_SETTING_KEYS = new Set([
|
|
'ui.theme',
|
|
'keys.tavily',
|
|
'keys.openrouter',
|
|
'keys.serper',
|
|
'modelslugimage',
|
|
'systemprompt-prefix',
|
|
'systemprompt-suffix',
|
|
]);
|
|
|
|
export async function list(googleAuthId, options) {
|
|
const store = await getStore();
|
|
return store.companysetting.list(googleAuthId, options);
|
|
}
|
|
|
|
export async function getByKey(googleAuthId, key, options) {
|
|
const store = await getStore();
|
|
return store.companysetting.get(googleAuthId, key, options);
|
|
}
|
|
|
|
export async function set(googleAuthId, input) {
|
|
if (ADMIN_ONLY_SETTING_KEYS.has(input?.key)) {
|
|
await requireSelectedCompanyAdmin(googleAuthId);
|
|
}
|
|
const store = await getStore();
|
|
return store.companysetting.set(googleAuthId, input);
|
|
} |