Fix some UI issues 2
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
AuthHealthResponse
|
||||
} from '../types/auth';
|
||||
import { ApiError } from '../client';
|
||||
import { useAuthStore } from '../../stores/auth.store';
|
||||
|
||||
// Query Keys
|
||||
export const authKeys = {
|
||||
@@ -149,6 +150,11 @@ export const useUpdateProfile = (
|
||||
onSuccess: (data) => {
|
||||
// Update the profile cache
|
||||
queryClient.setQueryData(authKeys.profile(), data);
|
||||
// Update the auth store user to maintain consistency
|
||||
const authStore = useAuthStore.getState();
|
||||
if (authStore.user) {
|
||||
authStore.updateUser(data);
|
||||
}
|
||||
},
|
||||
...options,
|
||||
});
|
||||
|
||||
@@ -14,6 +14,8 @@ import type {
|
||||
RecipeFeasibilityResponse,
|
||||
RecipeStatisticsResponse,
|
||||
RecipeCategoriesResponse,
|
||||
RecipeQualityConfiguration,
|
||||
RecipeQualityConfigurationUpdate,
|
||||
} from '../types/recipes';
|
||||
|
||||
/**
|
||||
@@ -139,6 +141,65 @@ export class RecipesService {
|
||||
const baseUrl = this.getBaseUrl(tenantId);
|
||||
return apiClient.get<RecipeCategoriesResponse>(`${baseUrl}/categories/list`);
|
||||
}
|
||||
|
||||
// Quality Configuration Methods
|
||||
|
||||
/**
|
||||
* Get quality configuration for a recipe
|
||||
*/
|
||||
async getRecipeQualityConfiguration(
|
||||
tenantId: string,
|
||||
recipeId: string
|
||||
): Promise<RecipeQualityConfiguration> {
|
||||
const baseUrl = this.getBaseUrl(tenantId);
|
||||
return apiClient.get<RecipeQualityConfiguration>(`${baseUrl}/${recipeId}/quality-configuration`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update quality configuration for a recipe
|
||||
*/
|
||||
async updateRecipeQualityConfiguration(
|
||||
tenantId: string,
|
||||
recipeId: string,
|
||||
qualityConfig: RecipeQualityConfigurationUpdate
|
||||
): Promise<RecipeQualityConfiguration> {
|
||||
const baseUrl = this.getBaseUrl(tenantId);
|
||||
return apiClient.put<RecipeQualityConfiguration>(
|
||||
`${baseUrl}/${recipeId}/quality-configuration`,
|
||||
qualityConfig
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add quality templates to a recipe stage
|
||||
*/
|
||||
async addQualityTemplatesToStage(
|
||||
tenantId: string,
|
||||
recipeId: string,
|
||||
stage: string,
|
||||
templateIds: string[]
|
||||
): Promise<{ message: string }> {
|
||||
const baseUrl = this.getBaseUrl(tenantId);
|
||||
return apiClient.post<{ message: string }>(
|
||||
`${baseUrl}/${recipeId}/quality-configuration/stages/${stage}/templates`,
|
||||
templateIds
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a quality template from a recipe stage
|
||||
*/
|
||||
async removeQualityTemplateFromStage(
|
||||
tenantId: string,
|
||||
recipeId: string,
|
||||
stage: string,
|
||||
templateId: string
|
||||
): Promise<{ message: string }> {
|
||||
const baseUrl = this.getBaseUrl(tenantId);
|
||||
return apiClient.delete<{ message: string }>(
|
||||
`${baseUrl}/${recipeId}/quality-configuration/stages/${stage}/templates/${templateId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Create and export singleton instance
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface User {
|
||||
phone?: string;
|
||||
language?: string;
|
||||
timezone?: string;
|
||||
avatar?: string; // User avatar image URL
|
||||
tenant_id?: string;
|
||||
role?: GlobalUserRole;
|
||||
}
|
||||
@@ -66,6 +67,7 @@ export interface UserResponse {
|
||||
phone?: string;
|
||||
language?: string;
|
||||
timezone?: string;
|
||||
avatar?: string; // User avatar image URL
|
||||
tenant_id?: string;
|
||||
role?: GlobalUserRole;
|
||||
}
|
||||
@@ -75,6 +77,7 @@ export interface UserUpdate {
|
||||
phone?: string;
|
||||
language?: string;
|
||||
timezone?: string;
|
||||
avatar?: string;
|
||||
}
|
||||
|
||||
export interface TokenVerificationResponse {
|
||||
|
||||
@@ -34,6 +34,31 @@ export enum ProductionStatus {
|
||||
CANCELLED = 'cancelled'
|
||||
}
|
||||
|
||||
// Quality Template Association Types
|
||||
export interface QualityStageConfiguration {
|
||||
template_ids: string[];
|
||||
required_checks: string[];
|
||||
optional_checks: string[];
|
||||
blocking_on_failure: boolean;
|
||||
min_quality_score?: number | null;
|
||||
}
|
||||
|
||||
export interface RecipeQualityConfiguration {
|
||||
stages: Record<string, QualityStageConfiguration>;
|
||||
overall_quality_threshold: number;
|
||||
critical_stage_blocking: boolean;
|
||||
auto_create_quality_checks: boolean;
|
||||
quality_manager_approval_required: boolean;
|
||||
}
|
||||
|
||||
export interface RecipeQualityConfigurationUpdate {
|
||||
stages?: Record<string, QualityStageConfiguration>;
|
||||
overall_quality_threshold?: number;
|
||||
critical_stage_blocking?: boolean;
|
||||
auto_create_quality_checks?: boolean;
|
||||
quality_manager_approval_required?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface RecipeIngredientCreate {
|
||||
ingredient_id: string;
|
||||
@@ -106,6 +131,7 @@ export interface RecipeCreate {
|
||||
preparation_notes?: string | null;
|
||||
storage_instructions?: string | null;
|
||||
quality_standards?: string | null;
|
||||
quality_check_configuration?: RecipeQualityConfiguration | null;
|
||||
serves_count?: number | null;
|
||||
nutritional_info?: Record<string, any> | null;
|
||||
allergen_info?: Record<string, any> | null;
|
||||
@@ -143,6 +169,7 @@ export interface RecipeUpdate {
|
||||
preparation_notes?: string | null;
|
||||
storage_instructions?: string | null;
|
||||
quality_standards?: string | null;
|
||||
quality_check_configuration?: RecipeQualityConfiguration | null;
|
||||
serves_count?: number | null;
|
||||
nutritional_info?: Record<string, any> | null;
|
||||
allergen_info?: Record<string, any> | null;
|
||||
@@ -189,6 +216,7 @@ export interface RecipeResponse {
|
||||
preparation_notes?: string | null;
|
||||
storage_instructions?: string | null;
|
||||
quality_standards?: string | null;
|
||||
quality_check_configuration?: RecipeQualityConfiguration | null;
|
||||
serves_count?: number | null;
|
||||
nutritional_info?: Record<string, any> | null;
|
||||
allergen_info?: Record<string, any> | null;
|
||||
|
||||
Reference in New Issue
Block a user