|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
import { AuthIdentity } from "./auth-identity" |
|
3
|
import { ProviderIdentity } from "./provider-identity" |
|
4
|
|
|
5
|
export const AuthPasswordResetToken = model |
|
6
|
.define("auth_password_reset_token", { |
|
7
|
id: model.id({ prefix: "authprt" }).primaryKey(), |
|
8
|
auth_identity: model.belongsTo(() => AuthIdentity, { |
|
9
|
mappedBy: "password_reset_tokens", |
|
10
|
}), |
|
11
|
provider_identity: model.belongsTo(() => ProviderIdentity, { |
|
12
|
mappedBy: "password_reset_tokens", |
|
13
|
}), |
|
14
|
entity_id: model.text(), |
|
15
|
token_hash: model.text(), |
|
16
|
expires_at: model.dateTime(), |
|
17
|
}) |
|
18
|
.indexes([ |
|
19
|
{ |
|
20
|
name: "IDX_auth_password_reset_token_provider_identity_id", |
|
21
|
on: ["provider_identity_id"], |
|
22
|
where: "deleted_at IS NULL", |
|
23
|
}, |
|
24
|
{ |
|
25
|
name: "IDX_auth_password_reset_token_token_hash", |
|
26
|
on: ["token_hash"], |
|
27
|
where: "deleted_at IS NULL", |
|
28
|
}, |
|
29
|
{ |
|
30
|
name: "IDX_auth_password_reset_token_expires_at", |
|
31
|
on: ["expires_at"], |
|
32
|
where: "deleted_at IS NULL", |
|
33
|
}, |
|
34
|
]) |