59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
import {
|
|
DALUtils,
|
|
generateEntityId,
|
|
Searchable,
|
|
} from "@medusajs/framework/utils"
|
|
import {
|
|
BeforeCreate,
|
|
Entity,
|
|
Filter,
|
|
OnInit,
|
|
PrimaryKey,
|
|
Property,
|
|
} from "@mikro-orm/core"
|
|
|
|
@Entity({ tableName: "refund_reason" })
|
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
|
export default class RefundReason {
|
|
@PrimaryKey({ columnType: "text" })
|
|
id: string
|
|
|
|
@Searchable()
|
|
@Property({ columnType: "text" })
|
|
label: string
|
|
|
|
@Property({ columnType: "text", nullable: true })
|
|
description: string | null = null
|
|
|
|
@Property({ columnType: "jsonb", nullable: true })
|
|
metadata: Record<string, unknown> | null = null
|
|
|
|
@Property({
|
|
onCreate: () => new Date(),
|
|
columnType: "timestamptz",
|
|
defaultRaw: "now()",
|
|
})
|
|
created_at: Date
|
|
|
|
@Property({
|
|
onCreate: () => new Date(),
|
|
onUpdate: () => new Date(),
|
|
columnType: "timestamptz",
|
|
defaultRaw: "now()",
|
|
})
|
|
updated_at: Date
|
|
|
|
@Property({ columnType: "timestamptz", nullable: true })
|
|
deleted_at: Date | null = null
|
|
|
|
@BeforeCreate()
|
|
onCreate() {
|
|
this.id = generateEntityId(this.id, "refr")
|
|
}
|
|
|
|
@OnInit()
|
|
onInit() {
|
|
this.id = generateEntityId(this.id, "refr")
|
|
}
|
|
}
|