chore(medusa,types): [11] Add request types to API routes (#8572)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import {
|
||||
BasePromotion,
|
||||
BasePromotionRule,
|
||||
BaseRuleAttributeOptions,
|
||||
BaseRuleOperatorOptions,
|
||||
BaseRuleValueOptions
|
||||
} from "../common";
|
||||
|
||||
export interface AdminPromotion extends BasePromotion {}
|
||||
export interface AdminPromotionRule extends BasePromotionRule {}
|
||||
export interface AdminRuleAttributeOption extends BaseRuleAttributeOptions {}
|
||||
export interface AdminRuleOperatorOption extends BaseRuleOperatorOptions {}
|
||||
export interface AdminRuleValueOption extends BaseRuleValueOptions {}
|
||||
@@ -1,4 +1,2 @@
|
||||
export * from "./promotion-rule"
|
||||
export * from "./rule-attribute-options"
|
||||
export * from "./rule-operator-options"
|
||||
export * from "./rule-value-options"
|
||||
export * from "./entities"
|
||||
export * from "./responses"
|
||||
@@ -1,15 +0,0 @@
|
||||
export interface PromotionRuleResponse {
|
||||
id: string
|
||||
attribute: string
|
||||
attribute_label: string
|
||||
field_type: string
|
||||
operator: string
|
||||
operator_label: string
|
||||
values: { value: string }[]
|
||||
disguised: boolean
|
||||
required: boolean
|
||||
}
|
||||
|
||||
export interface AdminPromotionRuleListResponse {
|
||||
rules: PromotionRuleResponse[]
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { BatchMethodResponse } from "../../../common";
|
||||
import { PaginatedResponse } from "../../common";
|
||||
import {
|
||||
AdminPromotion,
|
||||
AdminPromotionRule,
|
||||
AdminRuleAttributeOption,
|
||||
AdminRuleOperatorOption,
|
||||
AdminRuleValueOption
|
||||
} from "./entities";
|
||||
|
||||
export interface AdminPromotionResponse {
|
||||
promotion: AdminPromotion
|
||||
}
|
||||
|
||||
export type AdminPromotionListResponse = PaginatedResponse<{
|
||||
promotions: AdminPromotion[]
|
||||
}>
|
||||
|
||||
export interface PromotionRuleResponse {
|
||||
rule: AdminPromotionRule
|
||||
}
|
||||
|
||||
export type AdminPromotionRuleListResponse = {
|
||||
rules: AdminPromotionRule[]
|
||||
}
|
||||
|
||||
export interface RuleAttributeOptionsResponse {
|
||||
attribute: AdminRuleAttributeOption[]
|
||||
}
|
||||
|
||||
export type AdminRuleAttributeOptionsListResponse = {
|
||||
attributes: AdminRuleAttributeOption[]
|
||||
}
|
||||
|
||||
export interface RuleOperatorOptionsResponse {
|
||||
operator: AdminRuleOperatorOption
|
||||
}
|
||||
|
||||
export type AdminRuleOperatorOptionsListResponse = PaginatedResponse<{
|
||||
operators: AdminRuleOperatorOption[]
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface RuleValueOptionsResponse {
|
||||
value: AdminRuleValueOption
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export type AdminRuleValueOptionsListResponse = {
|
||||
values: AdminRuleValueOption[]
|
||||
}
|
||||
|
||||
export type AdminPromotionRuleBatchResponse = BatchMethodResponse<AdminPromotionRule>
|
||||
@@ -1,17 +0,0 @@
|
||||
export interface RuleAttributeOptionsResponse {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
field_type: string
|
||||
required: boolean
|
||||
disguised: boolean
|
||||
operators: {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export interface AdminRuleAttributeOptionsListResponse {
|
||||
attributes: RuleAttributeOptionsResponse[]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
export interface RuleOperatorOptionsResponse {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface AdminRuleOperatorOptionsListResponse {
|
||||
operators: RuleOperatorOptionsResponse[]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface RuleValueOptionsResponse {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminRuleValueOptionsListResponse {
|
||||
values: RuleValueOptionsResponse[]
|
||||
}
|
||||
@@ -1,12 +1,69 @@
|
||||
import { ApplicationMethodTypeValues } from "../../promotion"
|
||||
import {
|
||||
ApplicationMethodAllocationValues,
|
||||
ApplicationMethodTargetTypeValues,
|
||||
ApplicationMethodTypeValues,
|
||||
PromotionRuleOperatorValues,
|
||||
PromotionTypeValues
|
||||
} from "../../promotion"
|
||||
import { CampaignResponse } from "../campaign"
|
||||
|
||||
export interface BasePromotionRule {
|
||||
id: string
|
||||
description?: string | null
|
||||
attribute?: string
|
||||
operator?: PromotionRuleOperatorValues
|
||||
values: BasePromotionRuleValue[]
|
||||
}
|
||||
|
||||
export interface BaseApplicationMethod {
|
||||
id: string
|
||||
type?: ApplicationMethodTypeValues
|
||||
target_type?: ApplicationMethodTargetTypeValues
|
||||
allocation?: ApplicationMethodAllocationValues
|
||||
value?: number
|
||||
currency_code?: string
|
||||
max_quantity?: number | null
|
||||
buy_rules_min_quantity?: number | null
|
||||
apply_to_quantity?: number | null
|
||||
promotion?: BasePromotion
|
||||
target_rules?: BasePromotionRule[]
|
||||
buy_rules?: BasePromotionRule[]
|
||||
}
|
||||
|
||||
export interface BasePromotion {
|
||||
id: string
|
||||
code?: string
|
||||
type?: PromotionTypeValues
|
||||
is_automatic?: boolean
|
||||
application_method?: {
|
||||
type?: ApplicationMethodTypeValues
|
||||
value?: number
|
||||
currency_code?: string
|
||||
}
|
||||
application_method?: BaseApplicationMethod
|
||||
rules?: BasePromotionRule[]
|
||||
campaign_id?: string
|
||||
campaign?: CampaignResponse
|
||||
}
|
||||
|
||||
export interface BasePromotionRuleValue {
|
||||
id: string
|
||||
value?: string
|
||||
}
|
||||
|
||||
export interface BaseRuleAttributeOptions {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
field_type: string
|
||||
required: boolean
|
||||
disguised: boolean
|
||||
operators: BaseRuleOperatorOptions[]
|
||||
}
|
||||
|
||||
export interface BaseRuleOperatorOptions {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface BaseRuleValueOptions {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
Reference in New Issue
Block a user