File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
sample/sample17-controllers-inheritance Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,13 @@ import {Body} from "../../../src/decorator/Body";
9
9
import { MockedRepository } from "../repository/MockedRepository" ;
10
10
import { IInstance } from "../interface/IInstance" ;
11
11
12
+ /**
13
+ * @description the base controller class used by derivatives
14
+ */
12
15
export abstract class AbstractControllerTemplate {
16
+ /**
17
+ * @description domain part of a system, also called object|entity|model
18
+ */
13
19
protected domain : string ;
14
20
protected repository : MockedRepository ;
15
21
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ export class MockedRepository {
8
8
this . domain = domain ;
9
9
}
10
10
11
+ /**
12
+ * @description Dummy method to return collection of items
13
+ */
11
14
public getCollection ( ) : Promise < IInstance [ ] > {
12
15
return Promise . resolve ( [
13
16
{
@@ -25,6 +28,9 @@ export class MockedRepository {
25
28
] ) ;
26
29
}
27
30
31
+ /**
32
+ * @description Dummy method to create a new item in storage and return its instance
33
+ */
28
34
public create ( payload : IPayload ) : Promise < IInstance > {
29
35
return Promise . resolve (
30
36
{
@@ -34,6 +40,9 @@ export class MockedRepository {
34
40
) ;
35
41
}
36
42
43
+ /**
44
+ * @description Dummy method to find item in storage
45
+ */
37
46
public find ( id : number ) : Promise < IInstance > {
38
47
return Promise . resolve (
39
48
{
@@ -43,10 +52,16 @@ export class MockedRepository {
43
52
) ;
44
53
}
45
54
55
+ /**
56
+ * @description Dummy method to delete item in storage by id
57
+ */
46
58
public delete ( id : number ) : Promise < void > {
47
59
return Promise . resolve ( ) ;
48
60
}
49
61
62
+ /**
63
+ * @description Dummy method to update item in storage by id
64
+ */
50
65
public update ( id : number , payload : IPayload ) : Promise < IInstance > {
51
66
return Promise . resolve (
52
67
{
You can’t perform that action at this time.
0 commit comments