maggie-api
Version:
🧙♀️ A magical Express middleware to auto-generate CRUD APIs for Mongoose models with validation, unique keys, and middlewares.
16 lines (15 loc) • 743 B
TypeScript
import { Model } from "mongoose";
import { ISetting } from "../utils/interface";
import { Request } from "express";
export declare const createDoc: (model: Model<any>, data: any) => Promise<any>;
export declare const updateDoc: (model: Model<any>, data: any) => Promise<any>;
export declare const deleteById: (model: Model<any>, id: string) => Promise<any>;
export declare const getAll: (model: Model<any>, settings: ISetting, req: Request) => Promise<{
[x: string]: any;
pagination: any;
} | {
[x: string]: any[];
pagination?: undefined;
}>;
export declare const getById: (model: Model<any>, id: string, settings: ISetting) => Promise<any>;
export declare const insertMany: (model: Model<any>, docs: any[]) => Promise<any[]>;