Skip to content

Commit

Permalink
feat: add helper field/method to retrieve msisdn of the current session
Browse files Browse the repository at this point in the history
  • Loading branch information
ephrimlawrence committed Mar 19, 2024
1 parent 4106716 commit bee6f84
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 37 deletions.
73 changes: 44 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,24 @@
"redis": "^4.6.11"
},
"devDependencies": {
"@japa/api-client": "^2.0.0-1",
"@japa/assert": "2.0.0-2",
"@japa/runner": "3.0.0-9",
"@japa/api-client": "^2.0.2",
"@japa/assert": "2.1.0",
"@japa/runner": "3.1.1",
"@types/express": "^4.17.21",
"@types/node": "^20.4.5",
"tsup": "^8.0.1",
"tsx": "^4.2.0",
"typescript": "^4.8.4",
"rimraf": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.0",
"eslint-plugin-unused-imports": "^3.0.0",
"prettier-eslint": "^16.3.0"
"prettier-eslint": "^16.3.0",
"rimraf": "^5.0.1",
"tsup": "^8.0.1",
"tsx": "^4.2.0",
"typescript": "^4.8.4"
},
"dependencies": {
"arg": "^5.0.2"
}
}
1 change: 1 addition & 0 deletions src/gateways/wigal.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class WigalGateway extends Gateway {
// await this.session.setState(this.sessionId, _state);
this.request.state = _state;
this.request.input = this.request.query?.userdata!;
this.request.msisdn = _state.msisdn

return _state;
}
Expand Down
7 changes: 7 additions & 0 deletions src/menus/base.menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export abstract class BaseMenu {
};
}

/**
* Returns the current msisdn/phone number of the session.
*/
get msisdn(): string {
return this.request.state.msisdn
}

async back(): Promise<string | undefined> {
return undefined;
}
Expand Down
2 changes: 2 additions & 0 deletions src/types/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class Request {

url: string;

msisdn?: string;

/**
* The input from the user
*/
Expand Down

0 comments on commit bee6f84

Please sign in to comment.