import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { HydratedDocument } from 'mongoose'; import { IContact } from '../interfaces/contact.interface'; import { ContactType } from '../enums/contact-type.enum'; @Schema({ _id: false }) export class Contact implements IContact { @Prop({ type: String, enum: ContactType, required: true, }) type: ContactType; @Prop({ type: String, required: true }) value: string; @Prop({ type: Boolean, required: true, default: false }) verified: boolean; } export const ContactSchema = SchemaFactory.createForClass(Contact); export type ContactDocument = HydratedDocument;