diff --git a/.eslintrc-todo.json b/.eslintrc-todo.json index e9acb091..3218752a 100644 --- a/.eslintrc-todo.json +++ b/.eslintrc-todo.json @@ -553,14 +553,6 @@ "unused-imports/no-unused-vars": "warn" } }, - { - "files": [ - "src/store/modules/contexts.js" - ], - "rules": { - "@typescript-eslint/space-before-function-paren": "warn" - } - }, { "files": [ "src/store/modules/documents.js" @@ -604,14 +596,6 @@ "@typescript-eslint/comma-dangle": "warn" } }, - { - "files": [ - "src/store/plugins/caching/contexts.js" - ], - "rules": { - "no-case-declarations": "warn" - } - }, { "files": [ "src/store/plugins/caching/documents.js" diff --git a/composables/useWorkspaces.ts b/composables/useWorkspaces.ts new file mode 100644 index 00000000..51410163 --- /dev/null +++ b/composables/useWorkspaces.ts @@ -0,0 +1,21 @@ +import { cloneDeep } from 'lodash-es' +import type { Workspace } from '../src/db/databases/legacy' + +export const useWorkspaces = () => { + const { db } = useDatabase() + const { result: workspaces } = useQuery(() => db.workspaces.orderBy('name').toArray(), []) + + const addWorkspace = async (workspace: Workspace) => { + return db.workspaces.add(cloneDeep(workspace)) + } + + const destroyWorkspace = async (id: string) => { + return db.workspaces.delete(id) + } + + return { + addWorkspace, + destroyWorkspace, + workspaces, + } +} diff --git a/package.json b/package.json index b56ed7e6..843c03b6 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@tailwindcss/typography": "^0.5.10", "@types/culori": "^2.0.4", "@types/file-saver": "^2.0.7", + "@types/lodash-es": "^4.17.12", "@types/mime-types": "^2.1.4", "@types/node": "^18.19.4", "@types/remarkable": "^2.0.8", @@ -84,6 +85,7 @@ "eslint-generate-todo": "^0.2.0", "firebase-tools": "^13.3.1", "happy-dom": "^12.10.3", + "lodash-es": "^4.17.21", "micromark": "^3.1.0", "npm-run-all": "^4.1.5", "nuxt": "^3.9.0", diff --git a/pages/menu.vue b/pages/menu.vue index 4679816c..02d9fccf 100644 --- a/pages/menu.vue +++ b/pages/menu.vue @@ -1,11 +1,12 @@