-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathRawCapture.ts
More file actions
29 lines (26 loc) · 1 KB
/
RawCapture.ts
File metadata and controls
29 lines (26 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { delegateRepository } from 'infra/database/delegateRepository';
import RawCaptureRepository from 'infra/database/RawCaptureRepository';
import RawCapture from 'interfaces/Capture';
import RawCaptureFilter from 'interfaces/CaptureFilter';
import FilterOptions from 'interfaces/FilterOptions';
function getByFilter(
rawCaptureRepository: RawCaptureRepository,
): (filter: RawCaptureFilter, options: FilterOptions) => Promise<RawCapture[]> {
return async function (filter: RawCaptureFilter, options: FilterOptions) {
const captures = await rawCaptureRepository.getByFilter(filter, options);
return captures;
};
}
function getCount(
rawCaptureRepository: RawCaptureRepository,
): (filter: RawCaptureFilter) => Promise<string | number> {
return async function (filter: RawCaptureFilter) {
const count = await rawCaptureRepository.getCount(filter);
return count;
};
}
export default {
getByFilter,
getCount,
getById: delegateRepository<RawCaptureRepository, RawCapture>('getById'),
};