Files
edr-platform/apps/edr-freight-api/src/modules/otp/otp.entity.ts
2026-07-07 21:38:45 +00:00

39 lines
878 B
TypeScript

// otp.entity.ts
import {
Column,
Entity,
} from "typeorm";
import { BaseEntity } from "@edr/api-common";
@Entity({
// Table lives in the freight schema like every other freight entity. Without
// this the entity inherits the DataSource default schema (public), so TypeORM
// queries public.otp_verifications — which doesn't exist — and OTP verify
// (e.g. the contract-signature sudo gate) fails with a 500 QueryFailedError.
schema: "freight",
name: "otp_verifications",
})
export class OtpVerification extends BaseEntity{
// Exactly one of phone/email is set per row — the channel the code was sent
// through.
@Column({
unique: true,
nullable: true,
})
phone?: string;
@Column({
unique: true,
nullable: true,
})
email?: string;
@Column()
otp!: string;
@Column({
default: false,
})
verified!: boolean;
}