Fix new Frontend 8
This commit is contained in:
@@ -7,6 +7,7 @@ import { useState, useCallback } from 'react';
|
||||
import { dataService } from '../services';
|
||||
import type {
|
||||
SalesData,
|
||||
SalesValidationResult,
|
||||
SalesDataQuery,
|
||||
SalesImportResult,
|
||||
DashboardStats,
|
||||
@@ -52,7 +53,7 @@ export const useData = () => {
|
||||
const validateSalesData = useCallback(async (
|
||||
tenantId: string,
|
||||
file: File
|
||||
): Promise<SalesImportResult> => {
|
||||
): Promise<SalesValidationResult> => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { apiClient } from '../client';
|
||||
import { RequestTimeouts } from '../client/config';
|
||||
import type {
|
||||
SalesData,
|
||||
SalesValidationResult,
|
||||
SalesDataQuery,
|
||||
SalesDataImport,
|
||||
SalesImportResult,
|
||||
@@ -60,7 +61,7 @@ export class DataService {
|
||||
async validateSalesData(
|
||||
tenantId: string,
|
||||
file: File
|
||||
): Promise<SalesImportResult> {
|
||||
): Promise<SalesValidationResult> {
|
||||
const fileName = file.name.toLowerCase();
|
||||
let fileFormat: string;
|
||||
|
||||
@@ -75,11 +76,12 @@ export class DataService {
|
||||
}
|
||||
|
||||
return apiClient.upload(
|
||||
`/tenants/${tenantId}/sales/validate`,
|
||||
`/tenants/${tenantId}/sales/import/validate`,
|
||||
file,
|
||||
{
|
||||
file_format: fileFormat,
|
||||
validate_only: true,
|
||||
source: 'onboarding_upload',
|
||||
},
|
||||
{
|
||||
timeout: RequestTimeouts.MEDIUM,
|
||||
|
||||
@@ -18,6 +18,16 @@ export interface SalesData {
|
||||
external_factors?: ExternalFactors;
|
||||
}
|
||||
|
||||
export interface SalesValidationResult {
|
||||
is_valid: boolean;
|
||||
total_records: number;
|
||||
valid_records: number;
|
||||
invalid_records: number;
|
||||
errors: ValidationError[];
|
||||
warnings: ValidationError[];
|
||||
summary: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface ExternalFactors {
|
||||
weather_temperature?: number;
|
||||
weather_precipitation?: number;
|
||||
|
||||
Reference in New Issue
Block a user