fix: 🐛 fix db mock load

This commit is contained in:
Julien Oculi 2024-06-19 17:27:11 +02:00
parent 23ecb8de39
commit 22a6ffc4fb

View file

@ -5,13 +5,15 @@ import groups from './mock/groups.json' with { type: 'json' }
import users from './mock/users.json' with { type: 'json' } import users from './mock/users.json' with { type: 'json' }
import { User } from '@cohabit/ressources_manager/src/models/mod.ts' import { User } from '@cohabit/ressources_manager/src/models/mod.ts'
import { MailAddress } from '@cohabit/ressources_manager/types.ts' import { MailAddress } from '@cohabit/ressources_manager/types.ts'
import { existsSync } from '$std/fs/exists.ts' import { exists } from '$std/fs/exists.ts'
const dbPath = './_fresh/db.sqlite' const dbPath = './_fresh/db.sqlite'
const dbExist = await exists(dbPath)
export const db = await Db.init(dbPath) export const db = await Db.init(dbPath)
//! Temp for demo only //! Temp for demo only
if (!existsSync(dbPath)) { if (!dbExist) {
console.log('=============LOAD DB=============') console.log('=============LOAD DB=============')
// Load groups to DB // Load groups to DB