feat(medusa-react,medusa,types,dashboard): added empty state + table for promotions list page (#6827)

what:

- adds empty state for promotions list page
- lists all promotions with pagination

<img width="1663" alt="Screenshot 2024-03-26 at 14 19 27" src="https://github.com/medusajs/medusa/assets/5105988/ed0d5c65-d003-40f5-b899-540970d892f5">


<img width="1664" alt="Screenshot 2024-03-27 at 20 46 17" src="https://github.com/medusajs/medusa/assets/5105988/4aa40f09-fe3f-4f34-af7a-f5c183254c76">
This commit is contained in:
Riqwan Thamir
2024-03-29 11:22:42 +00:00
committed by GitHub
parent 6113af0a66
commit 0c0b425de7
33 changed files with 542 additions and 11 deletions
@@ -0,0 +1 @@
export * from "./promotions"
@@ -0,0 +1,2 @@
export * from "./types"
export * from "./validators"
@@ -1,12 +1,11 @@
import { createPromotionsWorkflow } from "@medusajs/core-flows"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { CreatePromotionDTO, IPromotionModuleService } from "@medusajs/types"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "../../../types/routing"
import { createPromotionsWorkflow } from "@medusajs/core-flows"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse
@@ -0,0 +1,5 @@
import { PaginatedResponse, PromotionDTO } from "@medusajs/types"
export type AdminPromotionsListRes = PaginatedResponse<{
promotions: PromotionDTO[]
}>
@@ -20,7 +20,11 @@ import {
ValidateIf,
ValidateNested,
} from "class-validator"
import { FindParams, extendedFindParamsMixin } from "../../../types/common"
import {
DateComparisonOperator,
FindParams,
extendedFindParamsMixin,
} from "../../../types/common"
import { XorConstraint } from "../../../types/validators/xor"
import { AdminPostCampaignsReq } from "../campaigns/validators"
@@ -33,6 +37,29 @@ export class AdminGetPromotionsParams extends extendedFindParamsMixin({
@IsString()
@IsOptional()
code?: string
/**
* Search terms to search promotions' code fields.
*/
@IsString()
@IsOptional()
q?: string
/**
* Date filters to apply on the promotions' `created_at` date.
*/
@IsOptional()
@ValidateNested()
@Type(() => DateComparisonOperator)
created_at?: DateComparisonOperator
/**
* Date filters to apply on the promotions' `updated_at` date.
*/
@IsOptional()
@ValidateNested()
@Type(() => DateComparisonOperator)
updated_at?: DateComparisonOperator
}
export class AdminPostPromotionsReq {