first
Deploy Iddaai Frontend / build-and-deploy (push) Successful in 4m0s

This commit is contained in:
2026-04-16 13:36:34 +03:00
parent de5e145c4e
commit fc7a1ba567
218 changed files with 32370 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import { apiRequest } from "@/lib/api/api-service";
import { ApiResponse } from "@/types/api-response";
import type { AnalyzeMatchesDto, AnalysisResultDto, AnalysisHistoryDto } from "./types";
/**
* Analysis Service
* Backend: /api/analysis/*
*/
const analyzeMatches = (dto: AnalyzeMatchesDto) => {
return apiRequest<ApiResponse<AnalysisResultDto>>({
url: "/analysis/analyze",
client: "core",
method: "post",
data: dto,
});
};
const getHistory = () => {
return apiRequest<ApiResponse<AnalysisHistoryDto>>({
url: "/analysis/history",
client: "core",
method: "get",
});
};
export const analysisService = {
analyzeMatches,
getHistory,
};
+24
View File
@@ -0,0 +1,24 @@
// ========================
// Request DTOs
// ========================
export interface AnalyzeMatchesDto {
matchIds: string[];
}
// ========================
// Response DTOs
// ========================
export interface AnalysisResultDto {
id: string;
matchIds: string[];
result: Record<string, unknown>;
createdAt: string;
[key: string]: unknown;
}
export interface AnalysisHistoryDto {
analyses: AnalysisResultDto[];
total: number;
}
+21
View File
@@ -0,0 +1,21 @@
import { useQuery, useMutation } from "@tanstack/react-query";
import { analysisService } from "./service";
import type { AnalyzeMatchesDto } from "./types";
export const AnalysisQueryKeys = {
all: ["analysis"] as const,
history: () => [...AnalysisQueryKeys.all, "history"] as const,
};
export const useAnalyzeMatches = () => {
return useMutation({
mutationFn: (dto: AnalyzeMatchesDto) => analysisService.analyzeMatches(dto),
});
};
export const useAnalysisHistory = () => {
return useQuery({
queryKey: AnalysisQueryKeys.history(),
queryFn: () => analysisService.getHistory(),
});
};