UNPKG

855 BTypeScriptView Raw
1import type { Types } from 'mongoose';
2import type { AnyParamConstructor, DocumentType, RefType } from './types';
3export declare abstract class TimeStamps {
4 createdAt?: Date;
5 updatedAt?: Date;
6}
7/**
8 * This Interface can be used when "_id" and "id" need to be defined in types
9 */
10export interface Base<IDType extends RefType = Types.ObjectId> {
11 _id: IDType;
12 /**
13 * This getter/setter doesn't exist if "schemaOptions.id" being set to "false"
14 */
15 id: string;
16}
17export interface FindOrCreateResult<T> {
18 created: boolean;
19 doc: DocumentType<T>;
20}
21/**
22 * This class contains all types for the module "mongoose-findorcreate"
23 */
24export declare abstract class FindOrCreate {
25 static findOrCreate: <T extends FindOrCreate>(this: AnyParamConstructor<T>, condition: any, createWith?: any) => Promise<FindOrCreateResult<T>>;
26}