Skip to content

Commit

Permalink
feat(model): add InvoiceOut/In
Browse files Browse the repository at this point in the history
  • Loading branch information
wmakeev committed Jul 2, 2021
1 parent 9d9d81f commit b6254e7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moysklad-api-model",
"version": "0.1.6",
"version": "0.1.7",
"description": "Объектная модель API МойСклад для TypeScript проектов",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion src/model/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import type { HasUpdated } from './HasUpdated'
import type { MetaType } from './MetaType'
import type { Owned } from './Owned'

// TODO Перечислить все документы
export type DocumentMetaType =
| MetaType.CustomerOrder
| MetaType.Demand
| MetaType.RetailDemand
| MetaType.PurchaseOrder
// TODO Описать остальные
| MetaType.InvoiceOut
| MetaType.InvoiceIn

export interface Document<T extends DocumentMetaType>
extends Entity<T>,
Expand Down
3 changes: 3 additions & 0 deletions src/model/InvoiceIn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { DocumentWithPositions, HasVat, MetaType } from '.'

export type InvoiceIn = DocumentWithPositions<MetaType.InvoiceIn> & HasVat
3 changes: 3 additions & 0 deletions src/model/InvoiceOut.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { DocumentWithPositions, HasVat, MetaType } from '.'

export type InvoiceOut = DocumentWithPositions<MetaType.InvoiceOut> & HasVat
6 changes: 4 additions & 2 deletions src/model/MetaType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import type {
RetailDemand,
State
} from '.'
import type { InvoiceIn } from './InvoiceIn'
import type { InvoiceOut } from './InvoiceOut'

export enum MetaType {
Account = 'account',
Expand Down Expand Up @@ -147,8 +149,8 @@ export type EntityByMetaType = {
[MetaType.InternalOrderPosition]: Entity<MetaType.InternalOrderPosition>
[MetaType.Inventory]: Entity<MetaType.Inventory>
[MetaType.InventoryPosition]: Entity<MetaType.InventoryPosition>
[MetaType.InvoiceIn]: Entity<MetaType.InvoiceIn>
[MetaType.InvoiceOut]: Entity<MetaType.InvoiceOut>
[MetaType.InvoiceIn]: InvoiceIn
[MetaType.InvoiceOut]: InvoiceOut
[MetaType.InvoicePosition]: Entity<MetaType.InvoicePosition>
[MetaType.Loss]: Entity<MetaType.Loss>
[MetaType.LossPosition]: Entity<MetaType.LossPosition>
Expand Down
2 changes: 2 additions & 0 deletions src/model/Position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type PositionTypeByDocument = {
[MetaType.Demand]: MetaType.DemandPosition
[MetaType.RetailDemand]: MetaType.DemandPosition
[MetaType.PurchaseOrder]: MetaType.PurchaseOrderPosition
[MetaType.InvoiceOut]: MetaType.InvoicePosition
[MetaType.InvoiceIn]: MetaType.InvoicePosition
}

export interface Position<T extends PositionMetaType> extends Entity<T> {
Expand Down

0 comments on commit b6254e7

Please sign in to comment.