|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
import { AuthMfaFactor } from "./auth-mfa-factor" |
|
3
|
import { AuthMfaRecoveryCode } from "./auth-mfa-recovery-code" |
|
4
|
import { AuthPasswordResetToken } from "./auth-password-reset-token" |
|
5
|
import { AuthVerification } from "./auth-verification" |
|
6
|
import { ProviderIdentity } from "./provider-identity" |
|
7
|
|
|
8
|
export const AuthIdentity = model |
|
9
|
.define("auth_identity", { |
|
10
|
id: model.id({ prefix: "authid" }).primaryKey(), |
|
11
|
provider_identities: model.hasMany(() => ProviderIdentity, { |
|
12
|
mappedBy: "auth_identity", |
|
13
|
}), |
|
14
|
mfa_factors: model.hasMany(() => AuthMfaFactor, { |
|
15
|
mappedBy: "auth_identity", |
|
16
|
}), |
|
17
|
mfa_recovery_codes: model.hasMany(() => AuthMfaRecoveryCode, { |
|
18
|
mappedBy: "auth_identity", |
|
19
|
}), |
|
20
|
verifications: model.hasMany(() => AuthVerification, { |
|
21
|
mappedBy: "auth_identity", |
|
22
|
}), |
|
23
|
password_reset_tokens: model.hasMany(() => AuthPasswordResetToken, { |
|
24
|
mappedBy: "auth_identity", |
|
25
|
}), |
|
26
|
app_metadata: model.json().nullable(), |
|
27
|
}) |
|
28
|
.cascades({ |
|
29
|
delete: [ |
|
30
|
"provider_identities", |
|
31
|
"mfa_factors", |
|
32
|
"mfa_recovery_codes", |
|
33
|
"verifications", |
|
34
|
"password_reset_tokens", |
|
35
|
], |
|
36
|
}) |