/
drug.controller.ts
68 lines (41 loc) · 1.42 KB
/
drug.controller.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
import * as yup from 'yup';
import {
Controller,
ConvectorController,
Invokable,
Param
} from '@worldsibu/convector-core-controller';
import { Drug } from '../src/drug.model';
import { Participant, ParticipantController } from '@worldsibu/convector-example-dsc-cc-participant';
import { TransportController, Transport } from '@worldsibu/convector-example-dsc-cc-transport';
import { History } from '@worldsibu/convector-core-model';
import { ControllerAdapter } from '@worldsibu/convector-core-adapter';
export class DrugControllerClient extends ConvectorController {
public name = 'drug';
constructor(public adapter: ControllerAdapter, public user?: string) {
super()
}
public async create(
id: string,
name: string,
owner: string,
created: number
) {
return await this.adapter.invoke(this.name, 'create', this.user, id, name, owner, created);
}
public async transfer(
drugId: string,
to: string,
reportHash,
reportUrl,
transport: string,
modified: number
) {
return await this.adapter.invoke(this.name, 'transfer', this.user, drugId, to, reportHash, reportUrl, transport, modified);
}
public async getHistory(
drugId: string
): Promise<History<Drug>[]> {
return await this.adapter.invoke(this.name, 'getHistory', this.user, drugId);
}
}