chore: prettier everywhere
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
'use server';
|
||||
|
||||
import { jiraAnomalyDetection, JiraAnomaly, AnomalyDetectionConfig } from '@/services/integrations/jira/anomaly-detection';
|
||||
import { JiraAnalyticsService, JiraAnalyticsConfig } from '@/services/integrations/jira/analytics';
|
||||
import {
|
||||
jiraAnomalyDetection,
|
||||
JiraAnomaly,
|
||||
AnomalyDetectionConfig,
|
||||
} from '@/services/integrations/jira/anomaly-detection';
|
||||
import {
|
||||
JiraAnalyticsService,
|
||||
JiraAnalyticsConfig,
|
||||
} from '@/services/integrations/jira/analytics';
|
||||
import { userPreferencesService } from '@/services/core/user-preferences';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
@@ -15,7 +22,9 @@ export interface AnomalyDetectionResult {
|
||||
/**
|
||||
* Détecte les anomalies dans les métriques Jira actuelles
|
||||
*/
|
||||
export async function detectJiraAnomalies(forceRefresh = false): Promise<AnomalyDetectionResult> {
|
||||
export async function detectJiraAnomalies(
|
||||
forceRefresh = false
|
||||
): Promise<AnomalyDetectionResult> {
|
||||
try {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.id) {
|
||||
@@ -23,12 +32,19 @@ export async function detectJiraAnomalies(forceRefresh = false): Promise<Anomaly
|
||||
}
|
||||
|
||||
// Récupérer la config Jira
|
||||
const jiraConfig = await userPreferencesService.getJiraConfig(session.user.id);
|
||||
|
||||
if (!jiraConfig?.baseUrl || !jiraConfig?.email || !jiraConfig?.apiToken || !jiraConfig?.projectKey) {
|
||||
const jiraConfig = await userPreferencesService.getJiraConfig(
|
||||
session.user.id
|
||||
);
|
||||
|
||||
if (
|
||||
!jiraConfig?.baseUrl ||
|
||||
!jiraConfig?.email ||
|
||||
!jiraConfig?.apiToken ||
|
||||
!jiraConfig?.projectKey
|
||||
) {
|
||||
return {
|
||||
success: false,
|
||||
error: 'Configuration Jira incomplète'
|
||||
error: 'Configuration Jira incomplète',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,8 +52,10 @@ export async function detectJiraAnomalies(forceRefresh = false): Promise<Anomaly
|
||||
if (!jiraConfig.baseUrl || !jiraConfig.projectKey) {
|
||||
return { success: false, error: 'Configuration Jira incomplète' };
|
||||
}
|
||||
|
||||
const analyticsService = new JiraAnalyticsService(jiraConfig as JiraAnalyticsConfig);
|
||||
|
||||
const analyticsService = new JiraAnalyticsService(
|
||||
jiraConfig as JiraAnalyticsConfig
|
||||
);
|
||||
const analytics = await analyticsService.getProjectAnalytics(forceRefresh);
|
||||
|
||||
// Détecter les anomalies
|
||||
@@ -45,13 +63,13 @@ export async function detectJiraAnomalies(forceRefresh = false): Promise<Anomaly
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: anomalies
|
||||
data: anomalies,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ Erreur lors de la détection d\'anomalies:', error);
|
||||
console.error("❌ Erreur lors de la détection d'anomalies:", error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue'
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -59,19 +77,21 @@ export async function detectJiraAnomalies(forceRefresh = false): Promise<Anomaly
|
||||
/**
|
||||
* Met à jour la configuration de détection d'anomalies
|
||||
*/
|
||||
export async function updateAnomalyDetectionConfig(config: Partial<AnomalyDetectionConfig>) {
|
||||
export async function updateAnomalyDetectionConfig(
|
||||
config: Partial<AnomalyDetectionConfig>
|
||||
) {
|
||||
try {
|
||||
jiraAnomalyDetection.updateConfig(config);
|
||||
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: jiraAnomalyDetection.getConfig()
|
||||
data: jiraAnomalyDetection.getConfig(),
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ Erreur lors de la mise à jour de la config:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue'
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -83,13 +103,13 @@ export async function getAnomalyDetectionConfig() {
|
||||
try {
|
||||
return {
|
||||
success: true,
|
||||
data: jiraAnomalyDetection.getConfig()
|
||||
data: jiraAnomalyDetection.getConfig(),
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ Erreur lors de la récupération de la config:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue'
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user