fix(medusa, pricing, types): pass dates as Date-objects rather than strings to the pricing module (#5768)
* init * remove date string validator; * add transformOptionalDate transformer to api * move type conversion to the datalayer * fix final module integration test * update arrow-function * make string optional * move work to utils * make check for value exists * move util back to pricng * change utils * refactor get-iso-string * fix build * flip transform condition * add null check for isDate * feat(pricing): Separate Pricing Module internal types from `@medusajs/types` (#5777) * create types for pricing repositories * create RepositoryTypes input * add service types * use models for repository types * fix build * update types to match interface types * add aliases * types instead of moduletypes * move repository to types for pricing module * add changeset * fix merge error * fix conflict * fix build * re-add validation of dates in updatePriceLists_
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { CreateMoneyAmountDTO, MoneyAmountDTO } from "./money-amount"
|
||||
import { CreateMoneyAmountDTO, MoneyAmountDTO } from "./money-amount";
|
||||
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import { PriceSetMoneyAmountDTO } from "./price-set-money-amount"
|
||||
import { RuleTypeDTO } from "./rule-type"
|
||||
import { BaseFilterable } from "../../dal";
|
||||
import { PriceSetMoneyAmountDTO } from "./price-set-money-amount";
|
||||
import { RuleTypeDTO } from "./rule-type";
|
||||
|
||||
/**
|
||||
* @enum
|
||||
@@ -152,11 +152,11 @@ export interface CreatePriceListDTO {
|
||||
/**
|
||||
* The price list is enabled starting from this date.
|
||||
*/
|
||||
starts_at?: string
|
||||
starts_at?: Date | string | null
|
||||
/**
|
||||
* The price list expires after this date.
|
||||
*/
|
||||
ends_at?: string
|
||||
ends_at?: Date | string | null
|
||||
/**
|
||||
* The price list's status.
|
||||
*/
|
||||
@@ -193,14 +193,18 @@ export interface UpdatePriceListDTO {
|
||||
* The price list's title.
|
||||
*/
|
||||
title?: string
|
||||
/**
|
||||
* The price list's description.
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* The price list is enabled starting from this date.
|
||||
*/
|
||||
starts_at?: string | null
|
||||
starts_at?: Date | string | null
|
||||
/**
|
||||
* The price list expires after this date.
|
||||
*/
|
||||
ends_at?: string | null
|
||||
ends_at?: Date | string | null
|
||||
/**
|
||||
* The price list's status.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { BaseFilterable } from "../../dal";
|
||||
import { CreateMoneyAmountDTO, FilterableMoneyAmountProps, MoneyAmountDTO } from "./money-amount";
|
||||
import { RuleTypeDTO } from "./rule-type";
|
||||
import { CreatePriceSetPriceRules } from "./price-list";
|
||||
import {
|
||||
CreateMoneyAmountDTO,
|
||||
FilterableMoneyAmountProps,
|
||||
MoneyAmountDTO,
|
||||
} from "./money-amount"
|
||||
import { RuleTypeDTO } from "./rule-type"
|
||||
import { Context } from "../../shared-context"
|
||||
|
||||
export interface PricingRepositoryService {
|
||||
calculatePrices(
|
||||
pricingFilters: PricingFilters,
|
||||
pricingContext: PricingContext,
|
||||
context: Context
|
||||
): Promise<CalculatedPriceSetDTO[]>
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface
|
||||
|
||||
@@ -60,8 +60,8 @@ export interface CreatePriceListWorkflowDTO {
|
||||
name: string
|
||||
description: string
|
||||
type?: string
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
starts_at?: Date
|
||||
ends_at?: Date
|
||||
status?: PriceListStatus
|
||||
rules_count?: number
|
||||
prices: InputPrice[]
|
||||
|
||||
@@ -10,8 +10,8 @@ export type PriceListVariantPriceDTO = UpdateProductVariantPricesInputDTO & {
|
||||
export interface UpdatePriceListWorkflowDTO {
|
||||
id: string
|
||||
name?: string
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
starts_at?: Date
|
||||
ends_at?: Date
|
||||
status?: PriceListStatus
|
||||
rules?: CreatePriceListRules
|
||||
prices?: PriceListVariantPriceDTO[]
|
||||
|
||||
Reference in New Issue
Block a user