11import { type MutateOptions , mutationOptions , queryOptions } from '@tanstack/react-query'
22import { db } from '@workspace/db/db'
3- import { dbSettingGetAll } from '@workspace/db/db- setting-get-all'
4- import { dbSettingGetValue } from '@workspace/db/db- setting-get-value'
5- import { dbSettingSetValue } from '@workspace/db/db- setting-set-value '
6- import type { SettingKey } from '@workspace/db/entity /setting-key '
3+ import { settingGetAll } from '@workspace/db/setting/ setting-get-all'
4+ import { settingGetValue } from '@workspace/db/setting/ setting-get-value'
5+ import type { SettingKey } from '@workspace/db/setting/setting-key '
6+ import { settingSetValue } from '@workspace/db/setting /setting-set-value '
77import { toastError } from '@workspace/ui/lib/toast-error'
88import { queryClient } from './db-query-client.tsx'
99
@@ -12,17 +12,17 @@ export type DbSettingSetValueMutateOptions = MutateOptions<void, Error, string>
1212export const dbSettingOptions = {
1313 getAll : ( ) =>
1414 queryOptions ( {
15- queryFn : ( ) => dbSettingGetAll ( db ) ,
16- queryKey : [ 'dbSettingGetAll ' ] ,
15+ queryFn : ( ) => settingGetAll ( db ) ,
16+ queryKey : [ 'settingGetAll ' ] ,
1717 } ) ,
1818 getValue : ( key : SettingKey ) =>
1919 queryOptions ( {
20- queryFn : ( ) => dbSettingGetValue ( db , key ) ,
21- queryKey : [ 'dbSettingGetValue ' , key ] ,
20+ queryFn : ( ) => settingGetValue ( db , key ) ,
21+ queryKey : [ 'settingGetValue ' , key ] ,
2222 } ) ,
2323 setValue : ( key : SettingKey , props : DbSettingSetValueMutateOptions = { } ) =>
2424 mutationOptions ( {
25- mutationFn : ( value : string ) => dbSettingSetValue ( db , key , value ) ,
25+ mutationFn : ( value : string ) => settingSetValue ( db , key , value ) ,
2626 onError : ( ) => toastError ( 'Error setting value' ) ,
2727 onSuccess : ( ) => {
2828 queryClient . invalidateQueries ( dbSettingOptions . getValue ( key ) )
0 commit comments