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 3 imports externes (components, pages)
|
||||||
- [x] Corriger imports database vers ../core/database
|
- [x] Corriger imports database vers ../core/database
|
||||||
|
|
||||||
### Phase 3: Data Management
|
### Phase 3: Data Management ✅
|
||||||
- [ ] **Déplacer `backup.ts`** → `data-management/backup.ts`
|
- [x] **Déplacer `backup.ts`** → `data-management/backup.ts`
|
||||||
- [ ] Corriger imports dans backup-scheduler et actions
|
- [x] Corriger 6 imports externes (clients, components, pages, API)
|
||||||
- [ ] **Déplacer `backup-scheduler.ts`** → `data-management/backup-scheduler.ts`
|
- [x] Corriger imports relatifs vers ../core/ et ../../lib/
|
||||||
- [ ] Corriger imports dans API routes
|
- [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
|
### Phase 4: Task Management
|
||||||
- [ ] **Déplacer `tasks.ts`** → `task-management/tasks.ts`
|
- [ ] **Déplacer `tasks.ts`** → `task-management/tasks.ts`
|
||||||
@@ -144,6 +146,10 @@ src/services/
|
|||||||
- [ ] `jira-anomaly-detection.ts` → `integrations/jira/anomaly-detection.ts`
|
- [ ] `jira-anomaly-detection.ts` → `integrations/jira/anomaly-detection.ts`
|
||||||
- [ ] Corriger tous les imports Jira dans actions, API routes, hooks
|
- [ ] 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:
|
### Points d'attention pour chaque service:
|
||||||
1. **Identifier tous les imports du service** (grep)
|
1. **Identifier tous les imports du service** (grep)
|
||||||
2. **Déplacer le fichier** vers le nouveau dossier
|
2. **Déplacer le fichier** vers le nouveau dossier
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
* Usage: tsx scripts/backup-manager.ts [command] [options]
|
* Usage: tsx scripts/backup-manager.ts [command] [options]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { backupService, BackupConfig } from '../src/services/backup';
|
import { backupService, BackupConfig } from '../src/services/data-management/backup';
|
||||||
import { backupScheduler } from '../src/services/backup-scheduler';
|
import { backupScheduler } from '../src/services/data-management/backup-scheduler';
|
||||||
import { formatDateForDisplay } from '../src/lib/date-utils';
|
import { formatDateForDisplay } from '../src/lib/date-utils';
|
||||||
|
|
||||||
interface CliOptions {
|
interface CliOptions {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
import { backupService } from '@/services/backup';
|
import { backupService } from '@/services/data-management/backup';
|
||||||
|
|
||||||
interface RouteParams {
|
interface RouteParams {
|
||||||
params: Promise<{
|
params: Promise<{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
import { backupService } from '@/services/backup';
|
import { backupService } from '@/services/data-management/backup';
|
||||||
import { backupScheduler } from '@/services/backup-scheduler';
|
import { backupScheduler } from '@/services/data-management/backup-scheduler';
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
export async function GET(request: NextRequest) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { tasksService } from '@/services/tasks';
|
import { tasksService } from '@/services/tasks';
|
||||||
import { tagsService } from '@/services/tags';
|
import { tagsService } from '@/services/tags';
|
||||||
import { backupService } from '@/services/backup';
|
import { backupService } from '@/services/data-management/backup';
|
||||||
import { backupScheduler } from '@/services/backup-scheduler';
|
import { backupScheduler } from '@/services/data-management/backup-scheduler';
|
||||||
import { AdvancedSettingsPageClient } from '@/components/settings/AdvancedSettingsPageClient';
|
import { AdvancedSettingsPageClient } from '@/components/settings/AdvancedSettingsPageClient';
|
||||||
|
|
||||||
// Force dynamic rendering for real-time data
|
// Force dynamic rendering for real-time data
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import BackupSettingsPageClient from '@/components/settings/BackupSettingsPageClient';
|
import BackupSettingsPageClient from '@/components/settings/BackupSettingsPageClient';
|
||||||
import { backupService } from '@/services/backup';
|
import { backupService } from '@/services/data-management/backup';
|
||||||
import { backupScheduler } from '@/services/backup-scheduler';
|
import { backupScheduler } from '@/services/data-management/backup-scheduler';
|
||||||
|
|
||||||
// Force dynamic rendering pour les données en temps réel
|
// Force dynamic rendering pour les données en temps réel
|
||||||
export const dynamic = 'force-dynamic';
|
export const dynamic = 'force-dynamic';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { httpClient } from './base/http-client';
|
import { httpClient } from './base/http-client';
|
||||||
import { BackupInfo, BackupConfig } from '@/services/backup';
|
import { BackupInfo, BackupConfig } from '@/services/data-management/backup';
|
||||||
|
|
||||||
export interface BackupListResponse {
|
export interface BackupListResponse {
|
||||||
backups: BackupInfo[];
|
backups: BackupInfo[];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { backupClient, BackupListResponse } from '@/clients/backup-client';
|
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 { Button } from '@/components/ui/Button';
|
||||||
import { Card, CardHeader, CardContent } from '@/components/ui/Card';
|
import { Card, CardHeader, CardContent } from '@/components/ui/Card';
|
||||||
import { Input } from '@/components/ui/Input';
|
import { Input } from '@/components/ui/Input';
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export class SystemInfoService {
|
|||||||
private static async getBackupCount(): Promise<number> {
|
private static async getBackupCount(): Promise<number> {
|
||||||
try {
|
try {
|
||||||
// Import dynamique pour éviter les dépendances circulaires
|
// 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();
|
const backups = await backupService.listBackups();
|
||||||
return backups.length;
|
return backups.length;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { prisma } from './core/database';
|
import { prisma } from '../core/database';
|
||||||
import { userPreferencesService } from './core/user-preferences';
|
import { userPreferencesService } from '../core/user-preferences';
|
||||||
import { BackupUtils } from '../lib/backup-utils';
|
import { BackupUtils } from '../../lib/backup-utils';
|
||||||
import { getToday } from '@/lib/date-utils';
|
import { getToday } from '@/lib/date-utils';
|
||||||
|
|
||||||
export interface BackupConfig {
|
export interface BackupConfig {
|
||||||
Reference in New Issue
Block a user