/
TransactionFilter.ts
104 lines (86 loc) Β· 1.88 KB
/
TransactionFilter.ts
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import {Type} from 'class-transformer'
import {
IsArray,
IsIn,
IsNotEmpty,
IsNumber,
IsNumberString,
IsOptional,
IsString,
Length,
Min,
ValidateNested,
} from 'class-validator'
import {OperationType, TransactionType} from '../response'
class AmountFilter {
@IsNotEmpty()
@IsIn(['lt', 'gt', 'gte', 'lte', 'eq', 'neq'])
public op: string;
@IsNotEmpty()
@IsNumberString()
public value: string;
}
export class TransactionFilter {
@Length(1, 50)
@IsString()
@IsOptional()
public id?: string;
@Min(0)
@IsNumber()
@IsOptional()
public from?: number;
@IsOptional()
@IsArray()
@ValidateNested()
@Type(() => AmountFilter)
public amount?: AmountFilter[];
@Min(0)
@IsNumber()
@IsOptional()
public to?: number;
@Length(1, 50)
@IsString()
@IsOptional()
public account?: string;
@Length(1, 50)
@IsString()
@IsOptional()
public counterAccount?: string;
@Length(1, 50)
@IsString()
@IsOptional()
public currency?: string;
@IsOptional()
@IsArray()
public currencies?: string[];
@IsOptional()
@IsArray()
@IsIn(Object.values(TransactionType), {each: true})
public transactionTypes?: TransactionType[];
@Length(1, 100)
@IsString()
@IsOptional()
public paymentId?: string;
@Length(1, 100)
@IsString()
@IsOptional()
public transactionCode?: string;
@Length(1, 500)
@IsString()
@IsOptional()
public senderNote?: string;
@Length(1, 500)
@IsString()
@IsOptional()
public recipientNote?: string;
@IsString()
@Length(4, 22)
@IsOptional()
@IsIn(Object.keys(OperationType))
public opType?: OperationType;
@IsOptional()
@Length(6, 23)
@IsIn(Object.keys(TransactionType))
@IsString()
public transactionType?: TransactionType;
}