Skip to content

Commit

Permalink
feat(model): DocumentWithPositions
Browse files Browse the repository at this point in the history
Использование DocumentWithPositions для еще не реализованнх документов с позициями
  • Loading branch information
wmakeev committed Dec 4, 2021
1 parent 5a93630 commit deb820d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
29 changes: 14 additions & 15 deletions src/model/MetaType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import type {
Demand,
DemandPosition,
Document,
DocumentMetaType,
DocumentWithPositions,
Employee,
Entity,
File,
Group,
Image,
Inventory,
InventoryPosition,
InvoiceIn,
InvoiceOut,
InvoicePosition,
Expand All @@ -29,13 +31,10 @@ import type {
Product,
ProductFolder,
RetailDemand,
SelectKeysByType,
State,
SalesReturn,
RetailSalesReturn,
SalesReturn,
SalesReturnPosition,
Inventory,
InventoryPosition
State
} from '.'

export type MetaType =
Expand Down Expand Up @@ -140,9 +139,9 @@ export type EntityByMetaType = {
cashier: Entity<'cashier'>
cashin: CashIn
cashout: CashOut
commissionreportin: Document<'commissionreportin'>
commissionreportin: DocumentWithPositions<'commissionreportin'>
commissionreportinposition: Position<'commissionreportinposition'>
commissionreportout: Document<'commissionreportout'>
commissionreportout: DocumentWithPositions<'commissionreportout'>
commissionreportoutposition: Position<'commissionreportoutposition'>
companysettings: Entity<'companysettings'>
consignment: Entity<'consignment'>
Expand All @@ -161,24 +160,24 @@ export type EntityByMetaType = {
discount: Entity<'discount'>
embeddedtemplate: Entity<'embeddedtemplate'>
employee: Employee
enter: Document<'enter'>
enter: DocumentWithPositions<'enter'>
enterposition: Position<'enterposition'>
expenseitem: Entity<'expenseitem'>
facturein: Document<'facturein'>
factureout: Document<'factureout'>
files: File
group: Group
image: Image
internalorder: Document<'internalorder'>
internalorder: DocumentWithPositions<'internalorder'>
internalorderposition: Position<'internalorderposition'>
inventory: Inventory
inventoryposition: InventoryPosition
invoicein: InvoiceIn
invoiceout: InvoiceOut
invoiceposition: InvoicePosition
loss: Document<'loss'>
loss: DocumentWithPositions<'loss'>
lossposition: Position<'lossposition'>
move: Document<'move'>
move: DocumentWithPositions<'move'>
moveposition: Position<'moveposition'>
note: AgentNote
organization: Organization
Expand All @@ -199,9 +198,9 @@ export type EntityByMetaType = {
product: Product
productfolder: ProductFolder
project: Entity<'project'>
purchaseorder: Document<'purchaseorder'>
purchaseorder: DocumentWithPositions<'purchaseorder'>
purchaseorderposition: Position<'purchaseorderposition'>
purchasereturn: Document<'purchasereturn'>
purchasereturn: DocumentWithPositions<'purchasereturn'>
purchasereturnposition: Position<'purchasereturnposition'>
region: Entity<'region'>
retaildemand: RetailDemand
Expand All @@ -216,7 +215,7 @@ export type EntityByMetaType = {
specialpricediscount: Entity<'specialpricediscount'>
state: State
store: Entity<'store'>
supply: Document<'supply'>
supply: DocumentWithPositions<'supply'>
supplyposition: Position<'supplyposition'>
task: Entity<'task'>
uom: Entity<'uom'>
Expand Down
14 changes: 13 additions & 1 deletion test/model/utils/Expand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
Organization,
AttributeBase,
Entity,
Product
Product,
DocumentWithPositions
} from '../../../src'

//#region
Expand Down Expand Up @@ -323,6 +324,17 @@ const t60_assortmentId: string = t60.positions.rows[0].assortment.id

//#endregion

//#region Expand abstract DocumentWithPositions
const t80 = {} as Expand<
DocumentWithPositions<'supply'>,
'agent,positions.assortment'
>

t80.agent.name

t80.positions.rows[0].assortment.id
//#endregion

// TODO 'positions.assortment,agent.attributes.value'
// TODO 'attributes.value,agent.attributes.value'
// TODO 'agent,operations,operations.customerOrder'

0 comments on commit deb820d

Please sign in to comment.