interface WebhooksRepository {
    modelName: string;
    countDocuments(query?: FilterQuery<Webhook>): Promise<number>;
    create(entity: Webhook): Promise<Saved<Webhook>>;
    createMany(
        entity: Webhook[],
        options?: CreateManyOptions,
    ): Promise<string[]>;
    deleteById(id: string): Promise<null | Saved<Webhook>>;
    destroyById(id: string): Promise<null | Saved<Webhook>>;
    findById(
        id: string,
        fields?: SelectQuery<Webhook>[],
        ListQueryOptions?: ListQueryOptions<Webhook>,
    ): Promise<null | Saved<Webhook>>;
    findOne(
        query?: FilterQuery<Webhook>,
        fields?: SelectQuery<Webhook>[],
        ListQueryOptions?: ListQueryOptions<Webhook>,
    ): Promise<null | Saved<Webhook>>;
    list(
        query?: FilterQuery<Webhook>,
        fields?: SelectQuery<Webhook>[],
        ListQueryOptions?: ListQueryOptions<Webhook>,
    ): Promise<Saved<Webhook>[]>;
    paginate(
        options?: PaginateQueryOptions<Webhook>,
    ): Promise<PaginationResponse<Saved<Webhook>>>;
    updateById(
        id: string,
        entity: PartialQuery<Webhook>,
        options?: UpdateOptions,
    ): Promise<null | Saved<Webhook>>;
    updateMany(
        filter: FilterQuery<Webhook>,
        update: PartialQuery<Webhook>,
    ): Promise<number>;
    updateOne(
        filter: FilterQuery<Webhook>,
        update: PartialQuery<Webhook>,
        options?: UpdateOneOptions,
    ): Promise<null | Saved<Webhook>>;
    upsertOne(
        filter: FilterQuery<Webhook>,
        entity: PartialQuery<Webhook>,
    ): Promise<null | string>;
}

Hierarchy (View Summary)

Properties

modelName: string

The name of the model.

Methods

  • Upsert a single record based on certain criteria.

    Parameters

    • filter: FilterQuery<Webhook>

      The filter to find the record to update or insert.

    • entity: PartialQuery<Webhook>

      The entity to upsert.

    Returns Promise<null | string>

    The return types of this method align with the MongoDB UpdateResult interface

    • Returns models.baseModel.Saved<T>['_id'] if the document did not exist (an upsert took place).
    • Returns null if the document did exist before the upsert operation.