@lxdhub/api
Version:
Display, search and copy LXD-images using a web interface.
24 lines (20 loc) • 752 B
text/typescript
import { Injectable } from '@nestjs/common';
import { PaginationOptionsDto, PaginationResponseDto } from '../common';
import { SyncRunRepository } from './sync-run.repository';
import { SyncRunListResponseFactory } from './factories';
import { SyncRunItemDto } from './dtos';
()
export class SyncRunService {
constructor(
private readonly syncRunRepository: SyncRunRepository,
private readonly syncRunFactory: SyncRunListResponseFactory
) {}
async paginate(pagination: PaginationOptionsDto) {
const [syncRuns, total] = await this.syncRunRepository.paginate(pagination);
return new PaginationResponseDto<SyncRunItemDto[]>(
this.syncRunFactory.entitiesToDto(syncRuns),
total,
pagination
);
}
}