Skip to content

Commit

Permalink
feat(model): add Inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
wmakeev committed Aug 24, 2021
1 parent fa49279 commit 0eecfc5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/model/Inventory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { DocumentWithPositions, DocumentWithPositionsPatch } from '.'

// export type InventoryFields = {}

export type Inventory = DocumentWithPositions<'inventory'> // & InventoryFields

export type InventoryPatch = DocumentWithPositionsPatch<'inventory'>
// & PartialNullable<Pick<InvoiceFields, 'paymentPlannedMoment'>>
20 changes: 20 additions & 0 deletions src/model/InventoryPosition.ts
Original file line number Diff line number Diff line change
@@ -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'
>
>
8 changes: 5 additions & 3 deletions src/model/MetaType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import type {
State,
SalesReturn,
RetailSalesReturn,
SalesReturnPosition
SalesReturnPosition,
Inventory,
InventoryPosition
} from '.'

export type MetaType =
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions src/model/utils/Patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import type {
DemandPatch,
DemandPosition,
EntityPatchRef,
InventoryPatch,
InventoryPositionPatch,
InvoiceInPatch,
InvoiceOutPatch,
InvoicePositionPatch,
Expand All @@ -32,6 +34,8 @@ export type PatchByMetaType = {
invoicein: InvoiceInPatch
invoiceout: InvoiceOutPatch
invoiceposition: InvoicePositionPatch
inventory: InventoryPatch
inventoryposition: InventoryPositionPatch
product: ProductPatch
productfolder: ProductFolderPatch
retaildemand: RetailDemand
Expand Down

0 comments on commit 0eecfc5

Please sign in to comment.