feat(tax): tax module scaffolding (#6417)

**What**
- Scaffolds the tax module
This commit is contained in:
Sebastian Rindom
2024-02-16 13:24:23 +00:00
committed by GitHub
parent 0d68eadf84
commit 7df4947ecf
31 changed files with 606 additions and 1 deletions
+1
View File
@@ -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"
+1
View File
@@ -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"
+49
View File
@@ -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>
}
+3
View File
@@ -0,0 +1,3 @@
export * from "./common"
export * from "./mutations"
export * from "./service"
+7
View File
@@ -0,0 +1,7 @@
export interface CreateTaxRateDTO {
rate?: number | null
code?: string | null
name: string
created_by?: string
metadata?: Record<string, unknown>
}
+34
View File
@@ -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>
}