Refactor logging in IcaRecipeParser and QuickImportService to use NestJS Logger
- Updated IcaRecipeParser to replace console.log statements with Logger for better logging practices. - Enhanced QuickImportService with Logger for consistent logging and error handling. - Changed quantity validation in CreateRecipeIngredientDto and CreateRecipeDto to allow zero. - Removed CanonicalNameForm and NameForm components from the frontend. - Updated EditProductForm to use a select dropdown for categories instead of a text input. - Added validation for product name, canonical name, and category length in product update action. - Refactored unit options into a separate file for better reusability across components. - Removed unused API fetching functions and inventory types to clean up the codebase.
This commit is contained in:
@@ -6,6 +6,7 @@ import { fetchJson } from '../../../lib/api';
|
||||
import { parseErrorResponse } from '../../../lib/error-handler';
|
||||
import type { Product } from '../../../features/inventory/types';
|
||||
import Navigation from '../../Navigation';
|
||||
import { UNIT_OPTIONS } from '../../../lib/units';
|
||||
|
||||
type ProductSuggestion = {
|
||||
productId: number;
|
||||
@@ -32,24 +33,6 @@ type ParseResult = {
|
||||
ingredients: ParsedIngredientRow[];
|
||||
};
|
||||
|
||||
const UNIT_OPTIONS = [
|
||||
{ value: '', label: 'Välj enhet' },
|
||||
{ value: 'g', label: 'g (gram)' },
|
||||
{ value: 'kg', label: 'kg (kilogram)' },
|
||||
{ value: 'hg', label: 'hg (hektogram)' },
|
||||
{ value: 'ml', label: 'ml (milliliter)' },
|
||||
{ value: 'dl', label: 'dl (deciliter)' },
|
||||
{ value: 'l', label: 'l (liter)' },
|
||||
{ value: 'st', label: 'st (styck)' },
|
||||
{ value: 'tsk', label: 'tsk (tesked)' },
|
||||
{ value: 'msk', label: 'msk (matsked)' },
|
||||
{ value: 'krm', label: 'krm (kryddmått)' },
|
||||
{ value: 'port', label: 'port (portioner)' },
|
||||
{ value: 'efter smak', label: 'Efter smak' },
|
||||
{ value: 'förp', label: 'förp (förpackning)' },
|
||||
{ value: 'klyfta', label: 'klyfta' },
|
||||
];
|
||||
|
||||
type Step = 'input' | 'review' | 'saving';
|
||||
|
||||
export default function WriteRecipePage() {
|
||||
|
||||
Reference in New Issue
Block a user