mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:33:05 +08:00
更新 Preferences 接口以使用排序的对象键,并调整默认偏好设置的结构。同时,在 preference.ts 文件中添加了关于 scope 字段的注释,说明其未来用途。此更改旨在提高代码的可读性和一致性。
This commit is contained in:
parent
c0efb46c2b
commit
ec491f5f24
@ -1,35 +1,35 @@
|
||||
export interface Preferences {
|
||||
/**
|
||||
* we should use sorted object keys
|
||||
* use `eslint --fix` to auto sort keys
|
||||
*/
|
||||
|
||||
/* eslint @typescript-eslint/member-ordering: ["error", {
|
||||
"interfaces": { "order": "alphabetically" },
|
||||
"typeLiterals": { "order": "alphabetically" }
|
||||
}] */
|
||||
export interface PreferencesType {
|
||||
default: {
|
||||
test1: string
|
||||
test2: number
|
||||
test3: boolean
|
||||
test4: string[]
|
||||
test5: {
|
||||
'app.test5': {
|
||||
content1: string
|
||||
content2: number
|
||||
}
|
||||
}
|
||||
user: {
|
||||
test1: string
|
||||
test2: number
|
||||
test3: boolean
|
||||
'sys.a.test3': boolean
|
||||
'sys.a.test4': string[]
|
||||
'ui.a.test1': string
|
||||
'ui.b.test2': number
|
||||
}
|
||||
}
|
||||
|
||||
export const defaultPreferences: Preferences = {
|
||||
/* eslint sort-keys: ["error", "asc", {"caseSensitive": true, "natural": false}] */
|
||||
export const defaultPreferences: PreferencesType = {
|
||||
default: {
|
||||
test1: 'test1',
|
||||
test2: 1,
|
||||
test3: true,
|
||||
test4: ['test4-1', 'test4-2'],
|
||||
test5: {
|
||||
'app.test5': {
|
||||
content1: 'test5-1',
|
||||
content2: 2
|
||||
}
|
||||
},
|
||||
user: {
|
||||
test1: 'test1',
|
||||
test2: 1,
|
||||
test3: false
|
||||
},
|
||||
'sys.a.test3': true,
|
||||
'sys.a.test4': ['test4-1', 'test4-2'],
|
||||
'ui.a.test1': 'test1',
|
||||
'ui.b.test2': 1
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { crudTimestamps } from './columnHelpers'
|
||||
export const preferenceTable = sqliteTable(
|
||||
'preference',
|
||||
{
|
||||
scope: text().notNull(),
|
||||
scope: text().notNull(), // scope is reserved for future use, now only 'default' is supported
|
||||
key: text().notNull(),
|
||||
value: text({ mode: 'json' }),
|
||||
...crudTimestamps
|
||||
|
||||
Loading…
Reference in New Issue
Block a user