feat(tax): tax module scaffolding (#6417)
**What** - Scaffolds the tax module
This commit is contained in:
@@ -18,6 +18,7 @@ export * as RegionTypes from "./region__legacy"
|
||||
export * as SalesChannelTypes from "./sales-channel"
|
||||
export * as SearchTypes from "./search"
|
||||
export * as StockLocationTypes from "./stock-location"
|
||||
export * as TaxTypes from "./tax"
|
||||
export * as TransactionBaseTypes from "./transaction-base"
|
||||
export * as UserTypes from "./user"
|
||||
export * as WorkflowTypes from "./workflow"
|
||||
|
||||
@@ -27,6 +27,7 @@ export * from "./sales-channel"
|
||||
export * from "./search"
|
||||
export * from "./shared-context"
|
||||
export * from "./stock-location"
|
||||
export * from "./tax"
|
||||
export * from "./totals"
|
||||
export * from "./transaction-base"
|
||||
export * from "./user"
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { BaseFilterable } from "../dal"
|
||||
import { OperatorMap } from "../dal/utils"
|
||||
|
||||
export interface TaxRateDTO {
|
||||
/**
|
||||
* The ID of the Tax Rate.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The numerical rate to charge.
|
||||
*/
|
||||
rate: number | null
|
||||
/**
|
||||
* The code the tax rate is identified by.
|
||||
*/
|
||||
code: string | null
|
||||
/**
|
||||
* The name of the Tax Rate. E.g. "VAT".
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata: Record<string, unknown> | null
|
||||
/**
|
||||
* When the Tax Rate was created.
|
||||
*/
|
||||
created_at: string | Date
|
||||
/**
|
||||
* When the Tax Rate was updated.
|
||||
*/
|
||||
updated_at: string | Date
|
||||
/**
|
||||
* The ID of the user that created the Tax Rate.
|
||||
*/
|
||||
created_by: string
|
||||
}
|
||||
|
||||
export interface FilterableTaxRateProps
|
||||
extends BaseFilterable<FilterableTaxRateProps> {
|
||||
id?: string | string[]
|
||||
|
||||
rate?: number | number[] | OperatorMap<number>
|
||||
code?: string | string[] | OperatorMap<string>
|
||||
name?: string | string[] | OperatorMap<string>
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
created_by?: string | string[] | OperatorMap<string>
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./common"
|
||||
export * from "./mutations"
|
||||
export * from "./service"
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface CreateTaxRateDTO {
|
||||
rate?: number | null
|
||||
code?: string | null
|
||||
name: string
|
||||
created_by?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { FindConfig } from "../common"
|
||||
import { IModuleService } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
import { FilterableTaxRateProps, TaxRateDTO } from "./common"
|
||||
import { CreateTaxRateDTO } from "./mutations"
|
||||
|
||||
export interface ITaxRateModuleService extends IModuleService {
|
||||
retrieve(
|
||||
taxRateId: string,
|
||||
config?: FindConfig<TaxRateDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<TaxRateDTO>
|
||||
|
||||
list(
|
||||
filters?: FilterableTaxRateProps,
|
||||
config?: FindConfig<TaxRateDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<TaxRateDTO[]>
|
||||
|
||||
listAndCount(
|
||||
filters?: FilterableTaxRateProps,
|
||||
config?: FindConfig<TaxRateDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<[TaxRateDTO[], number]>
|
||||
|
||||
create(
|
||||
data: CreateTaxRateDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<TaxRateDTO[]>
|
||||
create(data: CreateTaxRateDTO, sharedContext?: Context): Promise<TaxRateDTO>
|
||||
|
||||
delete(taxRateIds: string[], sharedContext?: Context): Promise<void>
|
||||
delete(taxRateId: string, sharedContext?: Context): Promise<void>
|
||||
}
|
||||
Reference in New Issue
Block a user