chore(payment): Payment module DML (#10553)
* chore(payment): Payment module DML * rm log * migration
This commit is contained in:
committed by
GitHub
parent
91cd9aad47
commit
0264294ab5
@@ -1,58 +1,14 @@
|
||||
import {
|
||||
DALUtils,
|
||||
generateEntityId,
|
||||
Searchable,
|
||||
} from "@medusajs/framework/utils"
|
||||
import {
|
||||
BeforeCreate,
|
||||
Entity,
|
||||
Filter,
|
||||
OnInit,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import { model } from "@medusajs/framework/utils"
|
||||
import Refund from "./refund"
|
||||
|
||||
@Entity({ tableName: "refund_reason" })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
export default class RefundReason {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
const RefundReason = model.define("RefundReason", {
|
||||
id: model.id({ prefix: "refr" }).primaryKey(),
|
||||
label: model.text().searchable(),
|
||||
description: model.text().nullable(),
|
||||
metadata: model.json().nullable(),
|
||||
refunds: model.hasMany(() => Refund, {
|
||||
mappedBy: "refund_reason",
|
||||
}),
|
||||
})
|
||||
|
||||
@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")
|
||||
}
|
||||
}
|
||||
export default RefundReason
|
||||
|
||||
Reference in New Issue
Block a user