huridocs/uwazi

View on GitHub
app/api/relationships.v2/services/GetMigrationHubRecordsService.ts

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
import { MigrationHubRecordDataSource } from '../contracts/MigrationHubRecordDataSource';

class GetMigrationHubRecordsService {
  private hubRecordsDS: MigrationHubRecordDataSource;

  constructor(hubRecordsDS: MigrationHubRecordDataSource) {
    this.hubRecordsDS = hubRecordsDS;
  }

  async getPage(page: number, pageSize: number) {
    const hubRecords = await this.hubRecordsDS.getAll().page(page, pageSize);
    const fullCount = await this.hubRecordsDS.countAll();
    return { hubRecords, fullCount };
  }
}

export { GetMigrationHubRecordsService };