feat: Add skeleton for api key module (#6451)

Adds a module skeleton for the API Key module.
Implementation of functionalities will follow in separate PRs
This commit is contained in:
Stevche Radevski
2024-02-20 13:28:57 +01:00
committed by GitHub
parent cfefd59249
commit 269be1b64a
30 changed files with 616 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import { generateEntityId } from "@medusajs/utils"
import {
BeforeCreate,
Entity,
OnInit,
PrimaryKey,
Property,
} from "@mikro-orm/core"
// TODO:
@Entity()
export default class ApiKey {
@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, "apk")
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "apk")
}
}

View File

@@ -0,0 +1 @@
export { default as ApiKey } from "./api-key"