fix(order): searchable fields (#9493)

FIXES: TRI-353
This commit is contained in:
Carlos R. L. Rodrigues
2024-10-07 14:45:20 -03:00
committed by GitHub
parent dc9c23be34
commit 8fbef8a667
6 changed files with 45 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import { DAL } from "@medusajs/framework/types"
import {
createPsqlIndexStatementHelper,
generateEntityId,
Searchable,
} from "@medusajs/framework/utils"
import {
BeforeCreate,
@@ -30,33 +31,42 @@ export default class OrderAddress {
@CustomerIdIndex.MikroORMIndex()
customer_id: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
company: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
first_name: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
last_name: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
address_1: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
address_2: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
city: string | null = null
@Property({ columnType: "text", nullable: true })
country_code: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
province: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
postal_code: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
phone: string | null = null

View File

@@ -1,6 +1,7 @@
import { DAL } from "@medusajs/framework/types"
import {
OrderStatus,
Searchable,
createPsqlIndexStatementHelper,
generateEntityId,
} from "@medusajs/framework/utils"
@@ -90,6 +91,7 @@ export default class Order {
@PrimaryKey({ columnType: "text" })
id: string
@Searchable()
@Property({ autoincrement: true, primary: false })
@DisplayIdIndex.MikroORMIndex()
display_id: number
@@ -130,6 +132,7 @@ export default class Order {
@IsDraftOrderIndex.MikroORMIndex()
is_draft_order: boolean = false
@Searchable()
@Property({ columnType: "text", nullable: true })
email: string | null = null

View File

@@ -70,7 +70,6 @@ export default class ReturnReason {
cascade: [Cascade.PERSIST],
})
parent_return_reason?: Rel<ReturnReason> | null
Searchable
@OneToMany(
() => ReturnReason,
(return_reason) => return_reason.parent_return_reason,