UNPKG

mongoose-restapi-ui

Version:

Rest api library for your mongoose apps, with react ui: mongoose-restapi-ui-component react library

53 lines (52 loc) 2.02 kB
/// <reference types="node" /> import { Model, Document } from 'mongoose'; import { Router } from 'express'; import { EventEmitter } from 'events'; import { ServeOptions, FullPathTypes, Path, InfoModel } from '../definitions/model'; import { IPermission } from './permissionSchema'; import { IRole } from './roleSchema'; import PermissionClass from './PermissionClass'; export default class RestApiPath<T extends Document> { private _route; private _model; private _options; private _emitter; private _paths; private _stringFullPaths; private _numberFullPaths; private _booleanFullPaths; private _dateFullPaths; private _objectIdFullPaths; private _refFullPaths; private _arrayFullPaths; private _fullPathTypes; private isMongo4; constructor(router: Router, route: string, model: Model<T>, options: ServeOptions, mongo4?: boolean); readonly MAX_RESULTS: number; readonly emitter: EventEmitter; readonly model: Model<T>; readonly route: string; readonly router: Router; readonly options: ServeOptions; readonly paths: Path[]; readonly infoModel: InfoModel; readonly arrayFullPaths: string[]; readonly refFullPaths: string[]; readonly fullPathTypes: FullPathTypes; readonly numberFullPaths: string[]; readonly stringFullPaths: string[]; readonly booleanFullPaths: string[]; readonly dateFullPaths: string[]; readonly objectIdFullPaths: string[]; private _generateFullPathTypes; private _getType; private _transformPaths; private _warnLabel; private _getModelProperties; private _getFullPathTypes; getItem(id: string, callback: (err: any, res?: any) => void): void; private _addPermission; private _deletePermission; static setRoleEndpoints(router: Router, route: string, Role: Model<IRole>): Router; setEndPoints(models: any, Permission: Model<IPermission>, Role: Model<IRole>): PermissionClass; }