Raw
1 import { model } from "@medusajs/framework/utils"
2 import { AuthIdentity } from "./auth-identity"
3
4 export const AuthMfaRecoveryCode = model
5 .define("auth_mfa_recovery_code", {
6 id: model.id({ prefix: "authmfarec" }).primaryKey(),
7 auth_identity: model.belongsTo(() => AuthIdentity, {
8 mappedBy: "mfa_recovery_codes",
9 }),
10 code_hash: model.text(),
11 })
12 .indexes([
13 {
14 name: "IDX_auth_mfa_recovery_code_auth_identity_id",
15 on: ["auth_identity_id"],
16 where: "deleted_at IS NULL",
17 },
18 {
19 name: "IDX_auth_mfa_recovery_code_auth_identity_code_hash",
20 on: ["auth_identity_id", "code_hash"],
21 unique: true,
22 where: "deleted_at IS NULL",
23 },
24 ])