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

Hierarchy (View Summary)

  • BaseRepo<ScheduledHook>
    • ScheduledHooksRepository

Properties

modelName: string

The name of the model.

Methods

  • Soft delete an entity by its ID. This operation marks the entity as deleted without permanently destroying the record.

    Parameters

    • id: string

      The ID of the entity to delete. @returns- A promise that resolves to the deleted entity or null if not found.

    Returns Promise<null | Saved<ScheduledHook>>

  • Find an entity by its ID.

    Parameters

    • id: string

      The ID of the entity to find.

    • Optionalfields: SelectQuery<ScheduledHook>[]

      Fields to select in the returned entity.

    • OptionalListQueryOptions: ListQueryOptions<ScheduledHook>

      Options for listing queries.

    Returns Promise<null | Saved<ScheduledHook>>

    • A promise that resolves to the found entity or null if not found.
  • Find one entity matching the query.

    Parameters

    • Optionalquery: FilterQuery<ScheduledHook>
    • Optionalfields: SelectQuery<ScheduledHook>[]
    • OptionalListQueryOptions: ListQueryOptions<ScheduledHook>

    Returns Promise<null | Saved<ScheduledHook>>

    • A promise that resolves to the found entity or null if not found.
  • Finds the first active scheduled hook for a specific model and hook type.

    Parameters

    • hookId: string

      The ID of the hook type to check for

    • modelId: string

      The ID of the model to check

    • Optionalfields: SelectQuery<ScheduledHook>[]

    Returns Promise<null | ScheduledHook>

    • True if an active scheduled hook exists, false otherwise
  • List entities matching the query.

    Parameters

    • Optionalquery: FilterQuery<ScheduledHook>

      The query to filter documents.

    • Optionalfields: SelectQuery<ScheduledHook>[]

      Fields to select in the returned entities.

    • OptionalListQueryOptions: ListQueryOptions<ScheduledHook>

      Options for listing queries.

    Returns Promise<Saved<ScheduledHook>[]>

    • A promise that resolves to an array of found entities.
  • Retrieve paginated results. Only intended for use with the admin portal for performance reasons.

    Parameters

    • Optionaloptions: PaginateQueryOptions<ScheduledHook>

      The pagination options

    Returns Promise<PaginationResponse<Saved<ScheduledHook>>>

  • Update an entity by its ID.

    Parameters

    • id: string

      The ID of the entity to update.

    • entity: PartialQuery<ScheduledHook>

      The partial entity to update.

    • Optionaloptions: UpdateOptions

    Returns Promise<null | Saved<ScheduledHook>>

    • A promise that resolves to the updated entity or null if not found.
  • Update multiple entities matching the filter.

    Parameters

    • filter: FilterQuery<ScheduledHook>

      The filter to match documents.

    • update: PartialQuery<ScheduledHook>

      The partial update to apply.

    Returns Promise<number>

    • A promise that resolves to the number of documents updated.
  • Update a single entity matching the filter.

    Parameters

    • filter: FilterQuery<ScheduledHook>

      The filter to match documents.

    • update: PartialQuery<ScheduledHook>

      The partial update to apply.

    • Optionaloptions: UpdateOneOptions

      Options for updating a single document.

    Returns Promise<null | Saved<ScheduledHook>>

    | null>} - A promise that resolves to the updated entity or null if not found.

  • Upsert a single record based on certain criteria.

    Parameters

    • filter: FilterQuery<ScheduledHook>

      The filter to find the record to update or insert.

    • entity: PartialQuery<ScheduledHook>

      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.