File: /var/www/api-parametros/src/app/parametros/schemas/parametro.schema.ts
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Types } from 'mongoose';
@Schema({ timestamps: true })
export class Parametro {
@Prop({
type: String,
required: true,
maxlength: 60,
})
codigo: string;
@Prop({
type: String,
required: true,
maxlength: 50,
})
nombre: string;
@Prop({
type: {
_id: { type: Types.ObjectId, ref: Parametro.name },
nombre: { type: String },
},
default: null,
})
tipoParametro: {
_id: Types.ObjectId;
nombre: string;
};
@Prop({
type: {
_id: { type: Types.ObjectId, ref: Parametro.name },
nombre: { type: String },
},
default: null,
})
padre: {
_id: Types.ObjectId;
nombre: string;
};
@Prop({
type: Types.ObjectId,
ref: Parametro.name,
maxlength: 30,
})
idTipoParametro: Types.ObjectId;
@Prop({
type: {
nombre: { type: String, required: true, maxlength: 60 },
codigo: { type: String, required: true, maxlength: 60 },
},
})
icon: {
nombre: string;
codigo: string;
};
@Prop({
type: Number,
max: 20,
})
posicion: number;
@Prop({
type: Boolean,
})
showMenu: boolean;
@Prop({
type: Date,
default: null,
})
deletedAt: Date;
}
export const ParametroSchema = SchemaFactory.createForClass(Parametro);