yeah
This commit is contained in:
23
server/tasks/syncCards.ts
Normal file
23
server/tasks/syncCards.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { syncCardsWithDatabase } from '../services/cardSync.service'
|
||||
|
||||
export default defineTask({
|
||||
meta: {
|
||||
name: 'sync-tracks',
|
||||
description: 'Synchronise les tracks avec le système de fichiers'
|
||||
},
|
||||
async run() {
|
||||
const config = useRuntimeConfig()
|
||||
const folderPath = config.pathFiles || process.env.PATH_FILES || 'mnt/media/files/music'
|
||||
|
||||
console.log('⏰ [TASK] Démarrage de la synchronisation planifiée...')
|
||||
|
||||
try {
|
||||
const result = await syncCardsWithDatabase(folderPath)
|
||||
console.log('✅ [TASK] Synchronisation terminée:', result)
|
||||
return { result }
|
||||
} catch (error: any) {
|
||||
console.error('❌ [TASK] Erreur lors de la synchronisation:', error)
|
||||
return { error: error.message }
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user