feat: Payment module package setup (#6059)

This commit is contained in:
Frane Polić
2024-01-11 16:41:40 +01:00
committed by GitHub
parent ce81cade88
commit 8472460f53
36 changed files with 531 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
export { default as Payment } from "./payment"
+40
View File
@@ -0,0 +1,40 @@
import {
BeforeCreate,
Entity,
OnInit,
PrimaryKey,
Property,
} from "@mikro-orm/core"
import { generateEntityId } from "@medusajs/utils"
@Entity({ tableName: "payment" })
export default class Payment {
@PrimaryKey({ columnType: "text" })
id: string
@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
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "pay")
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "pay")
}
}