refactor(group): Refactor grouping to add logic and optimize validation rules.

- Remove direct database operations and use groupRepository instead.
- Use notifyStore to unify notification messages.
This commit is contained in:
2025-10-15 14:34:59 +08:00
parent 8988766d09
commit 29843bb5e5
11 changed files with 198 additions and 119 deletions

View File

@@ -1,7 +1,8 @@
<script setup lang="ts">
import {ref} from 'vue'
import Database from "@tauri-apps/plugin-sql";
import {useRouter} from "vue-router";
import {groupRepository} from "@/entities/group.ts";
import {nodeRepository} from "@/entities/node.ts";
const router = useRouter()
@@ -17,19 +18,13 @@ interface Group {
id: number
}
const db = ref<any>(null)
const panels = ref([])
const groups = ref<Group[]>([])
const loadData = async () => {
db.value = await Database.load('sqlite:spary.db')
const groupsInDb = await db.value.select(
'SELECT * FROM `group`'
)
const nodesInDb = await db.value.select(
'SELECT * FROM `node`'
)
const groupsInDb = await groupRepository.findAll()
const nodesInDb = await nodeRepository.findAll()
for (let i = 0; i < groupsInDb.length; i++) {
const group: any = groupsInDb[i]