fea(providers): locking postgres (#9545)
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3b50c6d019
commit
e9a06f4b4d
@@ -0,0 +1 @@
|
||||
export { default as Locking } from "./locking"
|
||||
@@ -0,0 +1,32 @@
|
||||
import { generateEntityId } from "@medusajs/framework/utils"
|
||||
import {
|
||||
BeforeCreate,
|
||||
Entity,
|
||||
OnInit,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
|
||||
@Entity({ tableName: "locking" })
|
||||
class Locking {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id!: string
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
owner_id: string | null = null
|
||||
|
||||
@Property({ columnType: "timestamptz", nullable: true })
|
||||
expiration: Date | null = null
|
||||
|
||||
@BeforeCreate()
|
||||
onCreate() {
|
||||
this.id = generateEntityId(this.id, "lk")
|
||||
}
|
||||
|
||||
@OnInit()
|
||||
onInit() {
|
||||
this.id = generateEntityId(this.id, "lk")
|
||||
}
|
||||
}
|
||||
|
||||
export default Locking
|
||||
Reference in New Issue
Block a user