refactor: users domain (#7070)

**What**
- refactor users domain to use `DataTable`
- add search params to `User` module models
This commit is contained in:
Frane Polić
2024-04-16 16:09:07 +00:00
committed by GitHub
parent a7df6235f9
commit 122b3ea76b
10 changed files with 97 additions and 88 deletions
+2
View File
@@ -14,6 +14,7 @@ import {
DALUtils,
createPsqlIndexStatementHelper,
generateEntityId,
Searchable,
} from "@medusajs/utils"
const inviteEmailIndexName = "IDX_invite_email"
@@ -57,6 +58,7 @@ export default class Invite {
name: inviteEmailIndexName,
expression: inviteEmailIndexStatement,
})
@Searchable()
@Property({ columnType: "text" })
email: string
+5 -1
View File
@@ -14,6 +14,7 @@ import {
DALUtils,
createPsqlIndexStatementHelper,
generateEntityId,
Searchable,
} from "@medusajs/utils"
const userEmailIndexName = "IDX_user_email"
@@ -47,17 +48,20 @@ export default class User {
@PrimaryKey({ columnType: "text" })
id!: string
@Searchable()
@Property({ columnType: "text", nullable: true })
first_name: string | null = null
@Searchable()
@Property({ columnType: "text", nullable: true })
last_name: string | null = null
@Property({ columnType: "text" })
@Index({
name: userEmailIndexName,
expression: userEmailIndexStatement,
})
@Searchable()
@Property({ columnType: "text" })
email: string
@Property({ columnType: "text", nullable: true })