fea(providers): locking postgres (#9545)

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
Carlos R. L. Rodrigues
2024-10-17 10:11:39 -03:00
committed by GitHub
parent 3b50c6d019
commit e9a06f4b4d
18 changed files with 641 additions and 0 deletions

View File

@@ -0,0 +1 @@
export { default as Locking } from "./locking"

View File

@@ -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