-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcico.ts
More file actions
35 lines (28 loc) · 1.07 KB
/
cico.ts
File metadata and controls
35 lines (28 loc) · 1.07 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
import { Joi } from 'celebrate';
import { ContainerTypes, ValidatedRequestSchema, createValidator } from '../utils/queryValidator';
import { defaultSchema } from './defaultSchema';
import config from '~config/index';
const validator = createValidator();
type ListCICOProviderType = {
country?: string;
lat?: number;
lng?: number;
distance?: number;
type?: number;
limit: number;
offset: number;
};
const queryListBorrowersSchema = defaultSchema.object<ListCICOProviderType>({
country: Joi.string().optional(),
lat: Joi.number().optional(),
lng: Joi.number().optional(),
distance: Joi.number().optional(),
type: Joi.number().optional(),
limit: Joi.number().optional().default(config.defaultLimit),
offset: Joi.number().optional().default(config.defaultOffset)
});
interface ListCICOProviderRequestSchema extends ValidatedRequestSchema {
[ContainerTypes.Query]: ListCICOProviderType;
}
const listCICOProviderValidator = validator.query(queryListBorrowersSchema);
export { listCICOProviderValidator, ListCICOProviderRequestSchema };