feat(dashboard): Reservations and inventory item list pages (#6550)

**What**
- Adds list page for reservations and inventory items
- Adds new String filter type, that allows users to filter by a string, eg. "material === 'metal'"
- Adds new Number filter type, that allows users to filter by a number or numerical comparator, eg. quantity === 10 / quantity is gt 10 and lt 50.
This commit is contained in:
Kasper Fabricius Kristensen
2024-03-11 08:40:25 +00:00
committed by GitHub
parent d38b5eb790
commit fb25471e92
39 changed files with 1576 additions and 110 deletions
@@ -1,23 +1,20 @@
import { IsBoolean, IsOptional, IsString } from "class-validator"
import { Request, Response } from "express"
import {
ProductVariantInventoryService,
ProductVariantService,
} from "../../../../services"
import {
NumericalComparisonOperator,
StringComparisonOperator,
extendedFindParamsMixin,
} from "../../../../types/common"
import {
ProductVariantInventoryService,
ProductVariantService,
} from "../../../../services"
import { Request, Response } from "express"
import { getLevelsByInventoryItemId, joinLevels } from "./utils/join-levels"
import {
getVariantsByInventoryItemId,
joinVariants,
} from "./utils/join-variants"
import { joinLevels } from "./utils/join-levels"
import { joinVariants } from "./utils/join-variants"
import { IInventoryService } from "@medusajs/types"
import { IsType } from "../../../../utils/validators/is-type"
import { Transform } from "class-transformer"
import { IsType } from "../../../../utils/validators/is-type"
/**
* @oas [get] /admin/inventory-items
@@ -31,6 +28,7 @@ import { Transform } from "class-transformer"
* - (query) expand {string} Comma-separated relations that should be expanded in each returned inventory item.
* - (query) fields {string} Comma-separated fields that should be included in the returned inventory item.
* - (query) q {string} term to search inventory item's sku, title, and description.
* - (query) order {string} Field to sort-order inventory items by.
* - in: query
* name: location_id
* style: form
@@ -1,20 +1,20 @@
import {
DateComparisonOperator,
extendedFindParamsMixin,
NumericalComparisonOperator,
StringComparisonOperator,
} from "../../../../types/common"
import { IsArray, IsOptional, IsString, ValidateNested } from "class-validator"
import { Request, Response } from "express"
import {
DateComparisonOperator,
NumericalComparisonOperator,
StringComparisonOperator,
extendedFindParamsMixin,
} from "../../../../types/common"
import { EntityManager } from "typeorm"
import { IInventoryService } from "@medusajs/types"
import { IsType } from "../../../../utils/validators/is-type"
import { LineItemService } from "../../../../services"
import { promiseAll } from "@medusajs/utils"
import { Type } from "class-transformer"
import { EntityManager } from "typeorm"
import { LineItemService } from "../../../../services"
import { IsType } from "../../../../utils/validators/is-type"
import { joinInventoryItems } from "./utils/join-inventory-items"
import { joinLineItems } from "./utils/join-line-items"
import { promiseAll } from "@medusajs/utils"
/**
* @oas [get] /admin/reservations
@@ -288,7 +288,15 @@ export class AdminGetReservationsParams extends extendedFindParamsMixin({
created_at?: DateComparisonOperator
/**
* String filters tp apply on the reservations' `description` field.
* Date filters to apply on the reservations' `updated_at` field.
*/
@IsOptional()
@ValidateNested()
@Type(() => DateComparisonOperator)
updated_at?: DateComparisonOperator
/**
* String filters to apply on the reservations' `description` field.
*/
@IsOptional()
@IsType([StringComparisonOperator, String])