feat(user): Init user module (#6293)

* init user module

* add migration

* update module with latest utils

* pr ready

* make interface types interfaces
This commit is contained in:
Philip Korsholm
2024-02-06 11:10:54 +08:00
committed by GitHub
parent 823b98aaa1
commit b2eaac8cb1
43 changed files with 1008 additions and 29 deletions

View File

@@ -0,0 +1 @@
export { default as User } from "./user"

View File

@@ -0,0 +1,25 @@
import {
BeforeCreate,
Entity,
OnInit,
PrimaryKey,
} from "@mikro-orm/core"
import { generateEntityId } from "@medusajs/utils"
@Entity()
export default class User {
@PrimaryKey({ columnType: "text" })
id!: string
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "user")
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "user")
}
}