import {
  BaseRepository
} from "./chunk-J6KZS54B.js";

// runtime/base-classes/activity-entity-repository.ts
import { eq, between, desc } from "drizzle-orm";
var ActivityEntityRepository = class extends BaseRepository {
  /**
   * Find activities within a date range (inclusive).
   */
  async findByDateRange(start, end) {
    const rows = await this.baseQuery().where(between(this.table["occurredAt"], start, end));
    return rows;
  }
  /**
   * Find all activities for a specific user.
   */
  async findByUserId(userId) {
    const rows = await this.baseQuery().where(eq(this.table["userId"], userId));
    return rows;
  }
  /**
   * Find all activities for a specific opportunity.
   */
  async findByOpportunityId(opportunityId) {
    const rows = await this.baseQuery().where(eq(this.table["opportunityId"], opportunityId));
    return rows;
  }
  /**
   * Find the most recent activities for an opportunity, ordered by occurredAt desc.
   */
  async findRecentByOpportunityId(opportunityId, limit = 10) {
    const rows = await this.baseQuery().where(eq(this.table["opportunityId"], opportunityId)).orderBy(desc(this.table["occurredAt"])).limit(limit);
    return rows;
  }
};

export {
  ActivityEntityRepository
};
//# sourceMappingURL=chunk-XCEI7NUH.js.map