-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpagination.args.ts
More file actions
62 lines (57 loc) · 1.47 KB
/
Copy pathpagination.args.ts
File metadata and controls
62 lines (57 loc) · 1.47 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { Type } from 'class-transformer';
import { Field } from '../decorators/field.decorator';
export class PaginationArgs {
@Type(() => Number)
@Field({
name: 'skip',
description: 'Number of records to skip (offset based pagination).',
isInt: { message: 'skip must be an integer.' },
optional: true,
inQuery: true,
example: 0,
type: Number,
})
skip?: number;
@Field({
name: 'after',
description: 'Cursor to start after (forward cursor pagination).',
isString: { message: 'after must be a string cursor.' },
optional: true,
inQuery: true,
example: 'cursor123',
type: String,
})
after?: string;
@Field({
name: 'before',
description: 'Cursor to end before (backward cursor pagination).',
isString: { message: 'before must be a string cursor.' },
optional: true,
inQuery: true,
example: 'cursor122',
type: String,
})
before?: string;
@Type(() => Number)
@Field({
name: 'first',
description: 'Max number of items to return going forward from the cursor.',
isInt: { message: 'first must be an integer.' },
optional: true,
inQuery: true,
example: 25,
type: Number,
})
first?: number;
@Type(() => Number)
@Field({
name: 'last',
description: 'Max number of items to return going backward from the cursor.',
isInt: { message: 'last must be an integer.' },
optional: true,
inQuery: true,
example: 25,
type: Number,
})
last?: number;
}