-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinterfaces.ts
More file actions
executable file
·48 lines (31 loc) · 1.16 KB
/
interfaces.ts
File metadata and controls
executable file
·48 lines (31 loc) · 1.16 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
import {QueryInterface} from '@rxstack/query-filter';
import {OperationEvent} from './events/operation.event';
export const PLATFORM_OPERATION_KEY = 'RXSTACK_PLATFORM_OPERATION_KEY';
export type OperationCallback = (event: OperationEvent) => Promise<void>;
export interface Pagination {
count: number;
limit: number;
skip: number;
}
export interface ValidationError {
path: string;
value: any;
message: string;
}
export interface ServiceOptions {
idField: string;
defaultLimit: number;
}
export interface ServiceInterface<T> {
options: ServiceOptions;
insertOne(data: Object, options?: any): Promise<T>;
insertMany(data: Object[], options?: any): Promise<T[]>;
updateOne(id: any, data: Object, options?: any): Promise<void>;
updateMany(criteria: Object, data: Object, options?: any): Promise<number>;
removeOne(id: any, options?: any): Promise<void>;
removeMany(criteria: Object, options?: any): Promise<number>;
count(criteria?: Object, options?: any): Promise<number>;
find(id: any, options?: any): Promise<T>;
findOne(criteria: Object, options?: any): Promise<T>;
findMany(query?: QueryInterface, options?: any): Promise<T[]>;
}