File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 8181 "graphql-type-json" : " ^0.3.2" ,
8282 {{/apiGQL }}
8383 {{#needChannels }}
84- "@moleculer/channels" : " ^0.2.0 " ,
84+ "@moleculer/channels" : " github:moleculerjs/moleculer-channels#next " ,
8585 {{/needChannels }}
8686 {{#needWorkflows }}
8787 "@moleculer/workflows" : " ^0.1.2" ,
Original file line number Diff line number Diff line change 1- import type { Context , ServiceSchema } from "moleculer" ;
1+ import type { Context , ServiceSchema , ServiceSettingSchema } from "moleculer" ;
22
33interface ReserveParams {
44 productId : string ;
55 quantity : number ;
66}
7+ interface LocalMethods {
8+ uppercase ( text : string ) : string ;
9+ }
710
8- const InventoryService : ServiceSchema = {
11+ const InventoryService : ServiceSchema < ServiceSettingSchema , LocalMethods > = {
912 name : "inventory" ,
1013
1114 /**
@@ -25,6 +28,8 @@ const InventoryService: ServiceSchema = {
2528 `Reserve ${ ctx . params . quantity } pieces of the ${ ctx . params . productId } product in the inventory.`
2629 ) ;
2730
31+ this . uppercase ( "Hello" ) ;
32+
2833 await ctx . emit ( "inventory.reserved" , {
2934 productId : ctx . params . productId ,
3035 quantity : ctx . params . quantity
@@ -62,6 +67,12 @@ const InventoryService: ServiceSchema = {
6267 return true ;
6368 }
6469 }
70+ } ,
71+
72+ methods : {
73+ uppercase ( text : string ) : string {
74+ return text . toUpperCase ( ) ;
75+ }
6576 }
6677} ;
6778
You can’t perform that action at this time.
0 commit comments