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";
99import { MockedRepository } from "../repository/MockedRepository" ;
1010import { IInstance } from "../interface/IInstance" ;
1111
12+ /**
13+ * @description the base controller class used by derivatives
14+ */
1215export abstract class AbstractControllerTemplate {
16+ /**
17+ * @description domain part of a system, also called object|entity|model
18+ */
1319 protected domain : string ;
1420 protected repository : MockedRepository ;
1521
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ export class MockedRepository {
88 this . domain = domain ;
99 }
1010
11+ /**
12+ * @description Dummy method to return collection of items
13+ */
1114 public getCollection ( ) : Promise < IInstance [ ] > {
1215 return Promise . resolve ( [
1316 {
@@ -25,6 +28,9 @@ export class MockedRepository {
2528 ] ) ;
2629 }
2730
31+ /**
32+ * @description Dummy method to create a new item in storage and return its instance
33+ */
2834 public create ( payload : IPayload ) : Promise < IInstance > {
2935 return Promise . resolve (
3036 {
@@ -34,6 +40,9 @@ export class MockedRepository {
3440 ) ;
3541 }
3642
43+ /**
44+ * @description Dummy method to find item in storage
45+ */
3746 public find ( id : number ) : Promise < IInstance > {
3847 return Promise . resolve (
3948 {
@@ -43,10 +52,16 @@ export class MockedRepository {
4352 ) ;
4453 }
4554
55+ /**
56+ * @description Dummy method to delete item in storage by id
57+ */
4658 public delete ( id : number ) : Promise < void > {
4759 return Promise . resolve ( ) ;
4860 }
4961
62+ /**
63+ * @description Dummy method to update item in storage by id
64+ */
5065 public update ( id : number , payload : IPayload ) : Promise < IInstance > {
5166 return Promise . resolve (
5267 {
You can’t perform that action at this time.
0 commit comments