File: /var/www/myc/api-management/src/app/permisos/schemas/permiso.schema.ts
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
@Schema({ timestamps: true })
export class Item {
@Prop({
type: String,
})
_id: string;
@Prop({
type: String,
required: true,
maxlength: 60,
})
codigo: string;
@Prop({
type: String,
required: true,
maxlength: 250,
})
nombre: string;
@Prop({
type: { codigo: String },
required: true,
})
icon: { codigo: string };
@Prop({
type: Number,
required: true,
max: 10,
})
posicion: number;
@Prop({
type: Boolean,
required: true,
})
showMenu: boolean;
}
@Schema({ timestamps: true })
export class Permiso {
@Prop({
type: Item,
required: true,
})
modulo: Item;
@Prop({
type: Item,
required: true,
})
area: Item;
@Prop({
type: String,
required: true,
unique: true,
maxlength: 250,
})
nombre: string;
@Prop({
type: String,
required: true,
unique: true,
maxlength: 260,
})
slug: string;
@Prop({
type: String,
required: true,
maxlength: 700,
})
descripcion: string;
@Prop({ type: Date, default: null })
deletedAt: Date;
}
export type PermisoDocument = Permiso & Document;
export const PermisoSchema = SchemaFactory.createForClass(Permiso);