feat: complete Phase 3 of service refactoring
- Marked tasks in `TODO.md` as completed for moving backup-related files to the `data-management` directory and correcting imports across the codebase. - Updated imports in `backup-manager.ts`, API routes, and various components to reflect the new structure. - Removed obsolete `backup.ts` and `backup-scheduler.ts` files to streamline the codebase. - Added new tasks in `TODO.md` for future cleaning and organization of service imports.
This commit is contained in:
16
TODO.md
16
TODO.md
@@ -118,11 +118,13 @@ src/services/
|
||||
- [x] Corriger 3 imports externes (components, pages)
|
||||
- [x] Corriger imports database vers ../core/database
|
||||
|
||||
### Phase 3: Data Management
|
||||
- [ ] **Déplacer `backup.ts`** → `data-management/backup.ts`
|
||||
- [ ] Corriger imports dans backup-scheduler et actions
|
||||
- [ ] **Déplacer `backup-scheduler.ts`** → `data-management/backup-scheduler.ts`
|
||||
- [ ] Corriger imports dans API routes
|
||||
### Phase 3: Data Management ✅
|
||||
- [x] **Déplacer `backup.ts`** → `data-management/backup.ts`
|
||||
- [x] Corriger 6 imports externes (clients, components, pages, API)
|
||||
- [x] Corriger imports relatifs vers ../core/ et ../../lib/
|
||||
- [x] **Déplacer `backup-scheduler.ts`** → `data-management/backup-scheduler.ts`
|
||||
- [x] Corriger import dans script backup-manager.ts
|
||||
- [x] Corriger imports relatifs entre services
|
||||
|
||||
### Phase 4: Task Management
|
||||
- [ ] **Déplacer `tasks.ts`** → `task-management/tasks.ts`
|
||||
@@ -144,6 +146,10 @@ src/services/
|
||||
- [ ] `jira-anomaly-detection.ts` → `integrations/jira/anomaly-detection.ts`
|
||||
- [ ] Corriger tous les imports Jira dans actions, API routes, hooks
|
||||
|
||||
## phase 6: cleaning
|
||||
- [ ] Les imports des services dans les services : pourquoi ne pas utiliser @services/... ?
|
||||
- [ ] Les types & interfaces dans services : j'aimerai isoler les types et revoir les imports; par dossier un par un.
|
||||
|
||||
### Points d'attention pour chaque service:
|
||||
1. **Identifier tous les imports du service** (grep)
|
||||
2. **Déplacer le fichier** vers le nouveau dossier
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Usage: tsx scripts/backup-manager.ts [command] [options]
|
||||
*/
|
||||
|
||||
import { backupService, BackupConfig } from '../src/services/backup';
|
||||
import { backupScheduler } from '../src/services/backup-scheduler';
|
||||
import { backupService, BackupConfig } from '../src/services/data-management/backup';
|
||||
import { backupScheduler } from '../src/services/data-management/backup-scheduler';
|
||||
import { formatDateForDisplay } from '../src/lib/date-utils';
|
||||
|
||||
interface CliOptions {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { backupService } from '@/services/backup';
|
||||
import { backupService } from '@/services/data-management/backup';
|
||||
|
||||
interface RouteParams {
|
||||
params: Promise<{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { backupService } from '@/services/backup';
|
||||
import { backupScheduler } from '@/services/backup-scheduler';
|
||||
import { backupService } from '@/services/data-management/backup';
|
||||
import { backupScheduler } from '@/services/data-management/backup-scheduler';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { tasksService } from '@/services/tasks';
|
||||
import { tagsService } from '@/services/tags';
|
||||
import { backupService } from '@/services/backup';
|
||||
import { backupScheduler } from '@/services/backup-scheduler';
|
||||
import { backupService } from '@/services/data-management/backup';
|
||||
import { backupScheduler } from '@/services/data-management/backup-scheduler';
|
||||
import { AdvancedSettingsPageClient } from '@/components/settings/AdvancedSettingsPageClient';
|
||||
|
||||
// Force dynamic rendering for real-time data
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BackupSettingsPageClient from '@/components/settings/BackupSettingsPageClient';
|
||||
import { backupService } from '@/services/backup';
|
||||
import { backupScheduler } from '@/services/backup-scheduler';
|
||||
import { backupService } from '@/services/data-management/backup';
|
||||
import { backupScheduler } from '@/services/data-management/backup-scheduler';
|
||||
|
||||
// Force dynamic rendering pour les données en temps réel
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { httpClient } from './base/http-client';
|
||||
import { BackupInfo, BackupConfig } from '@/services/backup';
|
||||
import { BackupInfo, BackupConfig } from '@/services/data-management/backup';
|
||||
|
||||
export interface BackupListResponse {
|
||||
backups: BackupInfo[];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { backupClient, BackupListResponse } from '@/clients/backup-client';
|
||||
import { BackupConfig } from '@/services/backup';
|
||||
import { BackupConfig } from '@/services/data-management/backup';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Card, CardHeader, CardContent } from '@/components/ui/Card';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
|
||||
@@ -125,7 +125,7 @@ export class SystemInfoService {
|
||||
private static async getBackupCount(): Promise<number> {
|
||||
try {
|
||||
// Import dynamique pour éviter les dépendances circulaires
|
||||
const { backupService } = await import('../backup');
|
||||
const { backupService } = await import('../data-management/backup');
|
||||
const backups = await backupService.listBackups();
|
||||
return backups.length;
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { promises as fs } from 'fs';
|
||||
import path from 'path';
|
||||
import { prisma } from './core/database';
|
||||
import { userPreferencesService } from './core/user-preferences';
|
||||
import { BackupUtils } from '../lib/backup-utils';
|
||||
import { prisma } from '../core/database';
|
||||
import { userPreferencesService } from '../core/user-preferences';
|
||||
import { BackupUtils } from '../../lib/backup-utils';
|
||||
import { getToday } from '@/lib/date-utils';
|
||||
|
||||
export interface BackupConfig {
|
||||
Reference in New Issue
Block a user