diff --git a/src/model/Inventory.ts b/src/model/Inventory.ts new file mode 100644 index 0000000..73ce33e --- /dev/null +++ b/src/model/Inventory.ts @@ -0,0 +1,8 @@ +import type { DocumentWithPositions, DocumentWithPositionsPatch } from '.' + +// export type InventoryFields = {} + +export type Inventory = DocumentWithPositions<'inventory'> // & InventoryFields + +export type InventoryPatch = DocumentWithPositionsPatch<'inventory'> +// & PartialNullable> diff --git a/src/model/InventoryPosition.ts b/src/model/InventoryPosition.ts new file mode 100644 index 0000000..f405213 --- /dev/null +++ b/src/model/InventoryPosition.ts @@ -0,0 +1,20 @@ +import type { PartialNullable } from '../tools' +import type { Position, PositionPatch } from './Position' + +export type InventoryPositionFields = { + correctionAmount: number + calculatedQuantity: number + correctionSum: number +} + +export type InventoryPosition = Position<'inventoryposition'> & + InventoryPositionFields + +export type InventoryPositionPatch = PositionPatch<'invoiceposition'> & + PartialNullable< + Pick< + InventoryPositionFields, + // TODO InventoryPosition: А все поля изменяемые? + 'correctionAmount' | 'calculatedQuantity' | 'correctionSum' + > + > diff --git a/src/model/MetaType.ts b/src/model/MetaType.ts index 576e9fd..c250f2f 100644 --- a/src/model/MetaType.ts +++ b/src/model/MetaType.ts @@ -33,7 +33,9 @@ import type { State, SalesReturn, RetailSalesReturn, - SalesReturnPosition + SalesReturnPosition, + Inventory, + InventoryPosition } from '.' export type MetaType = @@ -169,8 +171,8 @@ export type EntityByMetaType = { image: Image internalorder: Entity<'internalorder'> internalorderposition: Position<'internalorderposition'> - inventory: Entity<'inventory'> - inventoryposition: Position<'inventoryposition'> + inventory: Inventory + inventoryposition: InventoryPosition invoicein: InvoiceIn invoiceout: InvoiceOut invoiceposition: InvoicePosition diff --git a/src/model/index.ts b/src/model/index.ts index 4f4116d..7bd4985 100644 --- a/src/model/index.ts +++ b/src/model/index.ts @@ -48,6 +48,8 @@ export * from './Invoice' export * from './InvoiceIn' export * from './InvoiceOut' export * from './InvoicePosition' +export * from './Inventory' +export * from './InventoryPosition' export * from './Legal' export * from './MediaType' export * from './Meta' diff --git a/src/model/utils/Patch.ts b/src/model/utils/Patch.ts index 2749f3b..d6f35c0 100644 --- a/src/model/utils/Patch.ts +++ b/src/model/utils/Patch.ts @@ -9,6 +9,8 @@ import type { DemandPatch, DemandPosition, EntityPatchRef, + InventoryPatch, + InventoryPositionPatch, InvoiceInPatch, InvoiceOutPatch, InvoicePositionPatch, @@ -32,6 +34,8 @@ export type PatchByMetaType = { invoicein: InvoiceInPatch invoiceout: InvoiceOutPatch invoiceposition: InvoicePositionPatch + inventory: InventoryPatch + inventoryposition: InventoryPositionPatch product: ProductPatch productfolder: ProductFolderPatch retaildemand: RetailDemand