fix: missing files

This commit is contained in:
fPolic
2024-01-11 11:35:01 +01:00
parent 824bcce3dd
commit c9f1858649
3 changed files with 48 additions and 1 deletions
+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")
}
}