fix: database location

Founded a major mistake: db overwrites during install.  Now all scripts save db in special folder and don't overwrite it.
This commit is contained in:
kilyabin
2025-12-04 23:44:21 +04:00
parent 3f74709513
commit 56a48b4552
9 changed files with 185 additions and 14 deletions

18
old/data/groups.ts Normal file
View File

@@ -0,0 +1,18 @@
// Загружаем группы из JSON файла только на сервере
// На клиенте будет пустой объект, группы должны передаваться через props
let groups: { [group: string]: [number, string] } = {}
// Используем условный require только на сервере для избежания включения fs в клиентскую сборку
if (typeof window === 'undefined') {
// Серверная сторона
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const groupsLoader = require('./groups-loader')
groups = groupsLoader.loadGroups()
} catch (error) {
console.error('Error loading groups:', error)
groups = {}
}
}
export { groups }