Skip to content

Commit

Permalink
fix(model): remove ImplementedDocumentsMetaType
Browse files Browse the repository at this point in the history
- add Document type to not implemented Document entities
- remove ImplementedDocumentsMetaType
  • Loading branch information
wmakeev committed Sep 4, 2021
1 parent 9018147 commit a9921de
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
38 changes: 15 additions & 23 deletions src/model/MetaType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ export type EntityByMetaType = {
cashier: Entity<'cashier'>
cashin: CashIn
cashout: CashOut
commissionreportin: Entity<'commissionreportin'>
commissionreportin: Document<'commissionreportin'>
commissionreportinposition: Position<'commissionreportinposition'>
commissionreportout: Entity<'commissionreportout'>
commissionreportout: Document<'commissionreportout'>
commissionreportoutposition: Position<'commissionreportoutposition'>
companysettings: Entity<'companysettings'>
consignment: Entity<'consignment'>
Expand All @@ -161,35 +161,35 @@ export type EntityByMetaType = {
discount: Entity<'discount'>
embeddedtemplate: Entity<'embeddedtemplate'>
employee: Employee
enter: Entity<'enter'>
enter: Document<'enter'>
enterposition: Position<'enterposition'>
expenseitem: Entity<'expenseitem'>
facturein: Entity<'facturein'>
factureout: Entity<'factureout'>
facturein: Document<'facturein'>
factureout: Document<'factureout'>
files: File
group: Group
image: Image
internalorder: Entity<'internalorder'>
internalorder: Document<'internalorder'>
internalorderposition: Position<'internalorderposition'>
inventory: Inventory
inventoryposition: InventoryPosition
invoicein: InvoiceIn
invoiceout: InvoiceOut
invoiceposition: InvoicePosition
loss: Entity<'loss'>
loss: Document<'loss'>
lossposition: Position<'lossposition'>
move: Entity<'move'>
move: Document<'move'>
moveposition: Position<'moveposition'>
note: AgentNote
organization: Organization
paymentin: PaymentIn
paymentout: PaymentOut
personaldiscount: Entity<'personaldiscount'>
pricelist: Entity<'pricelist'>
pricelist: Document<'pricelist'>
pricelistrow: Entity<'pricelistrow'>
pricetype: Entity<'pricetype'>
processing: Entity<'processing'>
processingorder: Entity<'processingorder'>
processingorder: Document<'processingorder'>
processingorderposition: Position<'processingorderposition'>
processingplan: Entity<'processingplan'>
processingplanmaterial: Entity<'processingplanmaterial'>
Expand All @@ -199,14 +199,14 @@ export type EntityByMetaType = {
product: Product
productfolder: ProductFolder
project: Entity<'project'>
purchaseorder: Entity<'purchaseorder'>
purchaseorder: Document<'purchaseorder'>
purchaseorderposition: Position<'purchaseorderposition'>
purchasereturn: Entity<'purchasereturn'>
purchasereturn: Document<'purchasereturn'>
purchasereturnposition: Position<'purchasereturnposition'>
region: Entity<'region'>
retaildemand: RetailDemand
retaildrawercashin: Entity<'retaildrawercashin'>
retaildrawercashout: Entity<'retaildrawercashout'>
retaildrawercashin: Document<'retaildrawercashin'>
retaildrawercashout: Document<'retaildrawercashout'>
retailsalesreturn: RetailSalesReturn
retailshift: Entity<'retailshift'>
retailstore: Entity<'retailstore'>
Expand All @@ -216,17 +216,9 @@ export type EntityByMetaType = {
specialpricediscount: Entity<'specialpricediscount'>
state: State
store: Entity<'store'>
supply: Entity<'supply'>
supply: Document<'supply'>
supplyposition: Position<'supplyposition'>
task: Entity<'task'>
uom: Entity<'uom'>
variant: Entity<'variant'>
}

/**
* MetaType документов для которых реализованы типы.
* */
export type ImplementedDocumentsMetaType = SelectKeysByType<
EntityByMetaType,
Document<DocumentMetaType>
>
10 changes: 5 additions & 5 deletions src/model/utils/PrefilledDocument.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DocumentWithPositionsMetaType } from '../DocumentWithPositions'
import type {
DocumentMetaType,
DocumentWithPositionsMetaType,
EntityByMetaType,
ImplementedDocumentsMetaType
} from '../MetaType'
import type { Expand } from './Expand'
Expand
} from '..'

// TODO Указать конкретные типы документов которые можно создавать этим методом

Expand All @@ -19,7 +19,7 @@ import type { Expand } from './Expand'
/**
* Шаблон нового документа `/entity/{type}/new`
*/
export type PrefilledDocument<T extends ImplementedDocumentsMetaType> = Omit<
export type PrefilledDocument<T extends DocumentMetaType> = Omit<
T extends DocumentWithPositionsMetaType
? Expand<EntityByMetaType[T], 'positions'>
: EntityByMetaType[T],
Expand Down

0 comments on commit a9921de

Please sign in to comment.