chore(feature-flags): Remove OrderEditing feature flag (#3006)
This commit is contained in:
@@ -2,7 +2,6 @@ export * from "./address"
|
||||
export * from "./analytics-config"
|
||||
export * from "./batch-job"
|
||||
export * from "./cart"
|
||||
export * from "./product-category"
|
||||
export * from "./claim-image"
|
||||
export * from "./claim-item"
|
||||
export * from "./claim-order"
|
||||
@@ -45,6 +44,7 @@ export * from "./payment-provider"
|
||||
export * from "./payment-session"
|
||||
export * from "./price-list"
|
||||
export * from "./product"
|
||||
export * from "./product-category"
|
||||
export * from "./product-collection"
|
||||
export * from "./product-option"
|
||||
export * from "./product-option-value"
|
||||
@@ -61,7 +61,6 @@ export * from "./region"
|
||||
export * from "./return"
|
||||
export * from "./return-item"
|
||||
export * from "./return-reason"
|
||||
export * from "./sales-channel-location"
|
||||
export * from "./sales-channel"
|
||||
export * from "./sales-channel-location"
|
||||
export * from "./shipping-method"
|
||||
|
||||
@@ -6,42 +6,35 @@ import {
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
OneToMany
|
||||
} from "typeorm"
|
||||
|
||||
import { BaseEntity } from "../interfaces"
|
||||
import TaxInclusivePricingFeatureFlag from "../loaders/feature-flags/tax-inclusive-pricing"
|
||||
import { generateEntityId } from "../utils"
|
||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||
import { FeatureFlagColumn } from "../utils/feature-flag-decorators"
|
||||
import { Cart } from "./cart"
|
||||
import { ClaimOrder } from "./claim-order"
|
||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||
import { LineItemAdjustment } from "./line-item-adjustment"
|
||||
import { LineItemTaxLine } from "./line-item-tax-line"
|
||||
import { Order } from "./order"
|
||||
import { OrderEdit } from "./order-edit"
|
||||
import { ProductVariant } from "./product-variant"
|
||||
import { Swap } from "./swap"
|
||||
import { generateEntityId } from "../utils"
|
||||
import {
|
||||
FeatureFlagClassDecorators,
|
||||
FeatureFlagColumn,
|
||||
FeatureFlagDecorators,
|
||||
} from "../utils/feature-flag-decorators"
|
||||
import TaxInclusivePricingFeatureFlag from "../loaders/feature-flags/tax-inclusive-pricing"
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
import { OrderEdit } from "./order-edit"
|
||||
|
||||
@Check(`"fulfilled_quantity" <= "quantity"`)
|
||||
@Check(`"shipped_quantity" <= "fulfilled_quantity"`)
|
||||
@Check(`"returned_quantity" <= "quantity"`)
|
||||
@Check(`"quantity" > 0`)
|
||||
@FeatureFlagClassDecorators(OrderEditingFeatureFlag.key, [
|
||||
Index(
|
||||
"unique_li_original_item_id_order_edit_id",
|
||||
["order_edit_id", "original_item_id"],
|
||||
{
|
||||
unique: true,
|
||||
where: "WHERE original_item_id IS NOT NULL AND order_edit_id IS NOT NULL",
|
||||
}
|
||||
),
|
||||
])
|
||||
@Index(
|
||||
"unique_li_original_item_id_order_edit_id",
|
||||
["order_edit_id", "original_item_id"],
|
||||
{
|
||||
unique: true,
|
||||
where: "original_item_id IS NOT NULL AND order_edit_id IS NOT NULL",
|
||||
}
|
||||
)
|
||||
@Entity()
|
||||
export class LineItem extends BaseEntity {
|
||||
@Index()
|
||||
@@ -84,25 +77,14 @@ export class LineItem extends BaseEntity {
|
||||
})
|
||||
adjustments: LineItemAdjustment[]
|
||||
|
||||
@FeatureFlagColumn(OrderEditingFeatureFlag.key, {
|
||||
nullable: true,
|
||||
type: "varchar",
|
||||
})
|
||||
@Column({ nullable: true, type: "varchar" })
|
||||
original_item_id?: string | null
|
||||
|
||||
@FeatureFlagColumn(OrderEditingFeatureFlag.key, {
|
||||
nullable: true,
|
||||
type: "varchar",
|
||||
})
|
||||
@Column({ nullable: true, type: "varchar" })
|
||||
order_edit_id?: string | null
|
||||
|
||||
@FeatureFlagDecorators(OrderEditingFeatureFlag.key, [
|
||||
ManyToOne(
|
||||
() => OrderEdit,
|
||||
(orderEdit) => orderEdit.items
|
||||
),
|
||||
JoinColumn({ name: "order_edit_id" }),
|
||||
])
|
||||
@ManyToOne(() => OrderEdit, (orderEdit) => orderEdit.items)
|
||||
@JoinColumn({ name: "order_edit_id" })
|
||||
order_edit?: OrderEdit | null
|
||||
|
||||
@Column()
|
||||
|
||||
@@ -2,18 +2,17 @@ import {
|
||||
AfterLoad,
|
||||
BeforeInsert,
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
OneToOne
|
||||
OneToOne,
|
||||
} from "typeorm"
|
||||
|
||||
import { BaseEntity } from "../interfaces"
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
import { generateEntityId } from "../utils"
|
||||
import { resolveDbType } from "../utils/db-aware-column"
|
||||
import { FeatureFlagEntity } from "../utils/feature-flag-decorators"
|
||||
|
||||
import { LineItem, Order, OrderItemChange, PaymentCollection } from "."
|
||||
|
||||
@@ -25,7 +24,7 @@ export enum OrderEditStatus {
|
||||
CANCELED = "canceled",
|
||||
}
|
||||
|
||||
@FeatureFlagEntity(OrderEditingFeatureFlag.key)
|
||||
@Entity()
|
||||
export class OrderEdit extends BaseEntity {
|
||||
@Index()
|
||||
@Column()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
BeforeInsert,
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToOne,
|
||||
@@ -8,12 +9,10 @@ import {
|
||||
} from "typeorm"
|
||||
|
||||
import { SoftDeletableEntity } from "../interfaces"
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
import { FeatureFlagEntity } from "../utils/feature-flag-decorators"
|
||||
import { generateEntityId } from "../utils"
|
||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||
import { OrderEdit } from "./order-edit"
|
||||
import { LineItem } from "./line-item"
|
||||
import { OrderEdit } from "./order-edit"
|
||||
|
||||
export enum OrderEditItemChangeType {
|
||||
ITEM_ADD = "item_add",
|
||||
@@ -21,9 +20,9 @@ export enum OrderEditItemChangeType {
|
||||
ITEM_UPDATE = "item_update",
|
||||
}
|
||||
|
||||
@FeatureFlagEntity(OrderEditingFeatureFlag.key)
|
||||
@Unique(["order_edit_id", "original_line_item_id"])
|
||||
@Unique(["order_edit_id", "line_item_id"])
|
||||
@Entity()
|
||||
export class OrderItemChange extends SoftDeletableEntity {
|
||||
@DbAwareColumn({
|
||||
type: "enum",
|
||||
|
||||
@@ -21,8 +21,10 @@ import {
|
||||
FeatureFlagDecorators,
|
||||
} from "../utils/feature-flag-decorators"
|
||||
|
||||
import { Address } from "./address"
|
||||
import { BaseEntity } from "../interfaces/models/base-entity"
|
||||
import { generateEntityId } from "../utils/generate-entity-id"
|
||||
import { manualAutoIncrement } from "../utils/manual-auto-increment"
|
||||
import { Address } from "./address"
|
||||
import { Cart } from "./cart"
|
||||
import { ClaimOrder } from "./claim-order"
|
||||
import { Currency } from "./currency"
|
||||
@@ -33,6 +35,7 @@ import { Fulfillment } from "./fulfillment"
|
||||
import { GiftCard } from "./gift-card"
|
||||
import { GiftCardTransaction } from "./gift-card-transaction"
|
||||
import { LineItem } from "./line-item"
|
||||
import { OrderEdit } from "./order-edit"
|
||||
import { Payment } from "./payment"
|
||||
import { Refund } from "./refund"
|
||||
import { Region } from "./region"
|
||||
@@ -40,10 +43,6 @@ import { Return } from "./return"
|
||||
import { SalesChannel } from "./sales-channel"
|
||||
import { ShippingMethod } from "./shipping-method"
|
||||
import { Swap } from "./swap"
|
||||
import { generateEntityId } from "../utils/generate-entity-id"
|
||||
import { manualAutoIncrement } from "../utils/manual-auto-increment"
|
||||
import { OrderEdit } from "./order-edit"
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
|
||||
export enum OrderStatus {
|
||||
PENDING = "pending",
|
||||
@@ -211,12 +210,7 @@ export class Order extends BaseEntity {
|
||||
@JoinColumn({ name: "draft_order_id" })
|
||||
draft_order: DraftOrder
|
||||
|
||||
@FeatureFlagDecorators(OrderEditingFeatureFlag.key, [
|
||||
OneToMany(
|
||||
() => OrderEdit,
|
||||
(oe) => oe.order
|
||||
),
|
||||
])
|
||||
@OneToMany(() => OrderEdit, (oe) => oe.order)
|
||||
edits: OrderEdit[]
|
||||
|
||||
@OneToMany(() => LineItem, (lineItem) => lineItem.order, {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
BeforeInsert,
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
JoinTable,
|
||||
@@ -8,13 +9,10 @@ import {
|
||||
ManyToOne,
|
||||
} from "typeorm"
|
||||
|
||||
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity"
|
||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||
import { generateEntityId } from "../utils"
|
||||
import { Currency, Payment, PaymentSession, Region } from "."
|
||||
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
import { FeatureFlagEntity } from "../utils/feature-flag-decorators"
|
||||
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity"
|
||||
import { generateEntityId } from "../utils"
|
||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||
|
||||
export enum PaymentCollectionStatus {
|
||||
NOT_PAID = "not_paid",
|
||||
@@ -28,7 +26,7 @@ export enum PaymentCollectionType {
|
||||
ORDER_EDIT = "order_edit",
|
||||
}
|
||||
|
||||
@FeatureFlagEntity(OrderEditingFeatureFlag.key)
|
||||
@Entity()
|
||||
export class PaymentCollection extends SoftDeletableEntity {
|
||||
@DbAwareColumn({ type: "enum", enum: PaymentCollectionType })
|
||||
type: PaymentCollectionType
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import { BeforeInsert, Column, Entity, Index, JoinColumn, ManyToOne, Unique, } from "typeorm"
|
||||
import {
|
||||
BeforeInsert,
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
Unique,
|
||||
} from "typeorm"
|
||||
|
||||
import { BaseEntity } from "../interfaces"
|
||||
import { Cart } from "./cart"
|
||||
import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column"
|
||||
import { generateEntityId } from "../utils"
|
||||
import { FeatureFlagDecorators } from "../utils/feature-flag-decorators"
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column"
|
||||
import { Cart } from "./cart"
|
||||
|
||||
export enum PaymentSessionStatus {
|
||||
AUTHORIZED = "authorized",
|
||||
@@ -16,8 +22,10 @@ export enum PaymentSessionStatus {
|
||||
}
|
||||
|
||||
@Unique("OneSelected", ["cart_id", "is_selected"])
|
||||
// TODO: This uniq constraint should be updated once the order edit flag is dropped and should add a where clause on cart_id is not null
|
||||
@Unique("UniqPaymentSessionCartIdProviderId", ["cart_id", "provider_id"])
|
||||
@Index("UniqPaymentSessionCartIdProviderId", ["cart_id", "provider_id"], {
|
||||
unique: true,
|
||||
where: "cart_id IS NOT NULL",
|
||||
})
|
||||
@Entity()
|
||||
export class PaymentSession extends BaseEntity {
|
||||
@Index()
|
||||
@@ -47,14 +55,10 @@ export class PaymentSession extends BaseEntity {
|
||||
@Column({ nullable: true })
|
||||
idempotency_key: string
|
||||
|
||||
@FeatureFlagDecorators(OrderEditingFeatureFlag.key, [
|
||||
Column({ type: "integer", nullable: true }),
|
||||
])
|
||||
@Column({ type: "integer", nullable: true })
|
||||
amount: number
|
||||
|
||||
@FeatureFlagDecorators(OrderEditingFeatureFlag.key, [
|
||||
Column({ type: resolveDbType("timestamptz"), nullable: true }),
|
||||
])
|
||||
@Column({ type: resolveDbType("timestamptz"), nullable: true })
|
||||
payment_authorized_at: Date
|
||||
|
||||
@BeforeInsert()
|
||||
|
||||
@@ -10,11 +10,9 @@ import {
|
||||
|
||||
import { BaseEntity } from "../interfaces/models/base-entity"
|
||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||
import { Order } from "./order"
|
||||
import { generateEntityId } from "../utils/generate-entity-id"
|
||||
import { Order } from "./order"
|
||||
import { Payment } from "./payment"
|
||||
import { FeatureFlagDecorators } from "../utils/feature-flag-decorators"
|
||||
import OrderEditingFeatureFlag from "../loaders/feature-flags/order-editing"
|
||||
|
||||
export enum RefundReason {
|
||||
DISCOUNT = "discount",
|
||||
@@ -30,20 +28,16 @@ export class Refund extends BaseEntity {
|
||||
@Column({ nullable: true })
|
||||
order_id: string
|
||||
|
||||
@FeatureFlagDecorators(OrderEditingFeatureFlag.key, [
|
||||
Index(),
|
||||
Column({ nullable: true }),
|
||||
])
|
||||
@Index()
|
||||
@Column({ nullable: true })
|
||||
payment_id: string
|
||||
|
||||
@ManyToOne(() => Order, (order) => order.payments)
|
||||
@JoinColumn({ name: "order_id" })
|
||||
order: Order
|
||||
|
||||
@FeatureFlagDecorators(OrderEditingFeatureFlag.key, [
|
||||
OneToOne(() => Payment, { nullable: true }),
|
||||
JoinColumn({ name: "payment_id" }),
|
||||
])
|
||||
@OneToOne(() => Payment, { nullable: true })
|
||||
@JoinColumn({ name: "payment_id" })
|
||||
payment: Payment
|
||||
|
||||
@Column({ type: "int" })
|
||||
|
||||
Reference in New Issue
Block a user