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:
41
packages/api-key/src/models/api-key.ts
Normal file
41
packages/api-key/src/models/api-key.ts
Normal 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")
|
||||
}
|
||||
}
|
||||
1
packages/api-key/src/models/index.ts
Normal file
1
packages/api-key/src/models/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as ApiKey } from "./api-key"
|
||||
Reference in New Issue
Block a user