chore: upgrade moduleResolution to Node16 (#9269)
This commit is contained in:
@@ -47,9 +47,8 @@ import {
|
||||
PriceSet,
|
||||
} from "@models"
|
||||
|
||||
import { ServiceTypes } from "@types"
|
||||
import { eventBuilders, validatePriceListDates } from "@utils"
|
||||
import { CreatePriceListDTO, UpsertPriceDTO } from "src/types/services"
|
||||
import { ServiceTypes } from "@types"
|
||||
import { joinerConfig } from "../joiner-config"
|
||||
|
||||
type InjectedDependencies = {
|
||||
@@ -590,7 +589,7 @@ export default class PricingModuleService
|
||||
price_list_id: priceListId,
|
||||
price_rules: hasRulesInput ? rules : undefined,
|
||||
rules_count: hasRulesInput ? ruleEntries.length : undefined,
|
||||
} as UpsertPriceDTO
|
||||
} as ServiceTypes.UpsertPriceDTO
|
||||
delete (entry as CreatePricesDTO).rules
|
||||
|
||||
const entryHash = hashPrice(entry)
|
||||
@@ -967,7 +966,7 @@ export default class PricingModuleService
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.flat() as UpsertPriceDTO[]
|
||||
.flat() as ServiceTypes.UpsertPriceDTO[]
|
||||
|
||||
const priceSetMap = new Map<string, PriceSetDTO>(
|
||||
priceSets.map((p) => [p.id, p])
|
||||
@@ -1025,18 +1024,18 @@ export default class PricingModuleService
|
||||
) {
|
||||
const normalized = this.normalizePriceListDate(data)
|
||||
|
||||
const priceListsToCreate: CreatePriceListDTO[] = normalized.map(
|
||||
(priceListData) => {
|
||||
const priceListsToCreate: ServiceTypes.CreatePriceListDTO[] =
|
||||
normalized.map((priceListData) => {
|
||||
const entry = {
|
||||
...priceListData,
|
||||
rules: undefined,
|
||||
} as CreatePriceListDTO
|
||||
} as ServiceTypes.CreatePriceListDTO
|
||||
|
||||
if (priceListData.prices) {
|
||||
entry.prices = this.normalizePrices(
|
||||
priceListData.prices,
|
||||
[]
|
||||
) as UpsertPriceDTO[]
|
||||
) as ServiceTypes.UpsertPriceDTO[]
|
||||
}
|
||||
|
||||
if (priceListData.rules) {
|
||||
@@ -1060,8 +1059,7 @@ export default class PricingModuleService
|
||||
}
|
||||
|
||||
return entry
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
const priceLists = await this.priceListService_.create(
|
||||
priceListsToCreate,
|
||||
@@ -1156,7 +1154,7 @@ export default class PricingModuleService
|
||||
|
||||
const normalizedData = this.normalizePriceListDate(data).map(
|
||||
(priceList) => {
|
||||
const entry: Partial<CreatePriceListDTO> = {
|
||||
const entry: Partial<ServiceTypes.CreatePriceListDTO> = {
|
||||
...priceList,
|
||||
rules: undefined,
|
||||
price_list_rules: undefined,
|
||||
@@ -1214,17 +1212,17 @@ export default class PricingModuleService
|
||||
const pricesToUpsert = data
|
||||
.map((addPrice) =>
|
||||
this.normalizePrices(
|
||||
addPrice.prices as UpsertPriceDTO[],
|
||||
addPrice.prices as ServiceTypes.UpsertPriceDTO[],
|
||||
existingPrices,
|
||||
addPrice.price_list_id
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.flat() as UpsertPriceDTO[]
|
||||
.flat() as ServiceTypes.UpsertPriceDTO[]
|
||||
|
||||
const priceListMap = new Map(priceLists.map((p) => [p.id, p]))
|
||||
|
||||
for (const { price_list_id: priceListId, prices } of data) {
|
||||
for (const { price_list_id: priceListId } of data) {
|
||||
const priceList = priceListMap.get(priceListId)
|
||||
|
||||
if (!priceList) {
|
||||
@@ -1276,7 +1274,7 @@ export default class PricingModuleService
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.flat() as UpsertPriceDTO[]
|
||||
.flat() as ServiceTypes.UpsertPriceDTO[]
|
||||
|
||||
const priceListMap = new Map(priceLists.map((p) => [p.id, p]))
|
||||
pricesToUpsert.forEach((price) => {
|
||||
@@ -1456,7 +1454,7 @@ export default class PricingModuleService
|
||||
data: (
|
||||
| ServiceTypes.UpdatePriceListDTO
|
||||
| ServiceTypes.CreatePriceListDTO
|
||||
| CreatePriceListDTO
|
||||
| ServiceTypes.CreatePriceListDTO
|
||||
)[]
|
||||
) {
|
||||
return data.map((priceListData: any) => {
|
||||
|
||||
Reference in New Issue
Block a user