Skip to content

Commit

Permalink
feat(resources): add StockLocations
Browse files Browse the repository at this point in the history
  • Loading branch information
reegodev committed Jan 11, 2022
1 parent 3036ef6 commit 3e14c01
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ export {
CustomerPaymentSources,
CustomerPaymentSourceInstance,
} from './resources/CustomerPaymentSources'
export {
StockLocations,
StockLocationInstance,
} from './resources/StockLocations'
52 changes: 52 additions & 0 deletions src/resources/StockLocations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {
ResourceConfig,
createResource,
ConcreteResourceInstance,
Resource,
} from '../resource'
import { AttachmentInstance } from './Attachments'

export interface StockLocationAttributes {
number: number
name: string
label_format: 'PDF' | 'ZPL' | 'EPL2' | 'PNG'
suppress_etd: boolean
}

export interface StockLocationRelationships {
inventory_stock_locations?: any[]
inventory_return_locations?: any[]
stock_items?: any[]
stock_transfers?: any[]
attachments?: AttachmentInstance[]
}

export type StockLocationInstance = ConcreteResourceInstance<
StockLocationAttributes,
StockLocationRelationships
>

export const StockLocationConfig: ResourceConfig<
StockLocationAttributes,
StockLocationRelationships
> = {
type: 'stock_locations',

attributes: ['number', 'name', 'label_format', 'suppress_etd'],

relationships: {
inventory_stock_locations: 'inventory_stock_locations',
inventory_return_locations: 'inventory_return_locations',
stock_items: 'stock_items',
stock_transfers: 'stock_transfers',
attachments: 'attachments',
},
}

export const StockLocations: Resource<
StockLocationAttributes,
StockLocationRelationships,
StockLocationInstance
> = createResource<StockLocationAttributes, StockLocationRelationships>(
StockLocationConfig,
)

0 comments on commit 3e14c01

Please sign in to comment.