feat(medusa,dahsboard): Initial work on pricing domain (#6633)
**What** - Initial work on pricing domain. - List page - Details page - Partial edit form - Fixes admin/price-lists/:id/products endpoint to allow filtering products by multiple ids. **Note** Pushing this now as the current design need a bit of tweaking so we display all relevant data to users. Future PR will include completed Edit moda, Create modal, Edit prices modal and Add prices modal.
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from "class-validator"
|
||||
import { isDefined } from "medusa-core-utils"
|
||||
import {
|
||||
DateComparisonOperator,
|
||||
extendedFindParamsMixin,
|
||||
@@ -15,11 +14,10 @@ import {
|
||||
import { FlagRouter, MedusaV2Flag } from "@medusajs/utils"
|
||||
import { Type } from "class-transformer"
|
||||
import { Request } from "express"
|
||||
import { pickBy } from "lodash"
|
||||
import { ProductStatus } from "../../../../models"
|
||||
import PriceListService from "../../../../services/price-list"
|
||||
import { FilterableProductProps } from "../../../../types/product"
|
||||
import { listProducts } from "../../../../utils"
|
||||
import { IsType, listProducts } from "../../../../utils"
|
||||
|
||||
/**
|
||||
* @oas [get] /admin/price-lists/{id}/products
|
||||
@@ -30,7 +28,19 @@ import { listProducts } from "../../../../utils"
|
||||
* parameters:
|
||||
* - (path) id=* {string} ID of the price list.
|
||||
* - (query) q {string} term used to search products' title, description, product variant's title and sku, and product collection's title.
|
||||
* - (query) id {string} Filter by product ID
|
||||
* - in: query
|
||||
* name: id
|
||||
* style: form
|
||||
* explode: false
|
||||
* description: Filter by product IDs.
|
||||
* schema:
|
||||
* oneOf:
|
||||
* - type: string
|
||||
* description: ID of the product.
|
||||
* - type: array
|
||||
* items:
|
||||
* type: string
|
||||
* description: ID of a product.
|
||||
* - in: query
|
||||
* name: status
|
||||
* description: Filter by product status
|
||||
@@ -62,7 +72,7 @@ import { listProducts } from "../../../../utils"
|
||||
* - (query) title {string} Filter by title
|
||||
* - (query) description {string} Filter by description
|
||||
* - (query) handle {string} Filter by handle
|
||||
* - (query) is_giftcard {string} A boolean value to filter by whether the product is a gift card or not.
|
||||
* - (query) is_giftcard {boolean} A boolean value to filter by whether the product is a gift card or not.
|
||||
* - (query) type {string} Filter product type.
|
||||
* - (query) order {string} A product field to sort-order the retrieved products by.
|
||||
* - in: query
|
||||
@@ -239,7 +249,7 @@ export default async (req: Request, res) => {
|
||||
} else {
|
||||
;[products, count] = await priceListService.listProducts(
|
||||
id,
|
||||
pickBy(filterableFields, (val) => isDefined(val)),
|
||||
filterableFields,
|
||||
req.listConfig
|
||||
)
|
||||
}
|
||||
@@ -264,9 +274,9 @@ export class AdminGetPriceListsPriceListProductsParams extends extendedFindParam
|
||||
/**
|
||||
* ID to filter products by.
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
id?: string
|
||||
@IsType([String, [String]])
|
||||
id?: string | string[]
|
||||
|
||||
/**
|
||||
* Search term to search products' title, description, product variant's title and sku, and product collection's title.
|
||||
@@ -323,7 +333,7 @@ export class AdminGetPriceListsPriceListProductsParams extends extendedFindParam
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
is_giftcard?: string
|
||||
is_giftcard?: boolean
|
||||
|
||||
/**
|
||||
* Type to filter products by.
|
||||
|
||||
Reference in New Issue
Block a user