Retrieves an item by hash, exporting entities, item type.
// Source: https://github.com/Asatelit/pwa-pos-terminal | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { Item } from 'common/types';
import { Entities } from 'common/enums';
import { getTimestamp, generateId } from 'common/utils';
export const getItemEntity = (data?: Partial<Item>): Item => ({
id: generateId(),
name: data?.name || '',
barcode: data?.barcode || '',
color: data?.color || null,
extras: data?.extras || [],
hasModificationsPrices: data?.hasModificationsPrices ?? false,
modifications: data?.modifications || [],
parentId: data?.parentId || Entities.RootCategoryId,
picture: data?.picture || null,
price: data?.price || 0,
costPrice: data?.cos
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key