import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document } from 'mongoose'; @Schema({ timestamps: true }) export class ErrorLog extends Document { @Prop({ required: true, index: true }) path!: string; @Prop({ required: true }) method!: string; @Prop({ required: true }) statusCode!: number; @Prop() errorName?: string; @Prop() message?: string; @Prop() stack?: string; @Prop() ip?: string; @Prop() userAgent?: string; @Prop({ type: Object }) requestContext?: Record; } export const ErrorLogSchema = SchemaFactory.createForClass(ErrorLog);