Skip to content

Commit c3bb6e4

Browse files
authored
fix(commands): adding target for subcommands (#141)
1 parent 7cabeed commit c3bb6e4

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

internal/engine/command/calculator/calculator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func (bc *Calculator) GetCommand() command.Command {
4242
SubCommands: nil,
4343
AppIDs: entity.AllAppIDs(),
4444
Handler: bc.calcRewardHandler,
45+
TargetFlag: command.TargetMaskMain,
4546
}
4647

4748
subCmdCalcFee := command.Command{
@@ -57,6 +58,7 @@ func (bc *Calculator) GetCommand() command.Command {
5758
SubCommands: nil,
5859
AppIDs: entity.AllAppIDs(),
5960
Handler: bc.calcFeeHandler,
61+
TargetFlag: command.TargetMaskMain,
6062
}
6163

6264
cmdBlockchain := command.Command{

internal/engine/command/market/market.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func (m *Market) GetCommand() command.Command {
3333
SubCommands: nil,
3434
AppIDs: entity.AllAppIDs(),
3535
Handler: m.getPrice,
36+
TargetFlag: command.TargetMaskMain,
3637
}
3738

3839
cmdMarket := command.Command{

internal/engine/command/network/network.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func (n *Network) GetCommand() command.Command {
7373
SubCommands: nil,
7474
AppIDs: entity.AllAppIDs(),
7575
Handler: n.nodeInfoHandler,
76+
TargetFlag: command.TargetMaskAll,
7677
}
7778

7879
subCmdHealth := command.Command{
@@ -82,6 +83,7 @@ func (n *Network) GetCommand() command.Command {
8283
SubCommands: nil,
8384
AppIDs: entity.AllAppIDs(),
8485
Handler: n.networkHealthHandler,
86+
TargetFlag: command.TargetMaskAll,
8587
}
8688

8789
subCmdStatus := command.Command{
@@ -91,6 +93,7 @@ func (n *Network) GetCommand() command.Command {
9193
SubCommands: nil,
9294
AppIDs: entity.AllAppIDs(),
9395
Handler: n.networkStatusHandler,
96+
TargetFlag: command.TargetMaskAll,
9497
}
9598

9699
cmdNetwork := command.Command{

internal/engine/command/phoenix/phoenix.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func (pt *Phoenix) GetCommand() command.Command {
4747
AppIDs: entity.AllAppIDs(),
4848
Middlewares: []command.MiddlewareFunc{middlewareHandler.CreateUser},
4949
Handler: pt.networkStatusHandler,
50+
TargetFlag: command.TargetMaskTest,
5051
}
5152

5253
subCmdFaucet := command.Command{
@@ -63,6 +64,7 @@ func (pt *Phoenix) GetCommand() command.Command {
6364
AppIDs: entity.AllAppIDs(),
6465
Middlewares: []command.MiddlewareFunc{middlewareHandler.CreateUser, middlewareHandler.WalletBalance},
6566
Handler: pt.faucetHandler,
67+
TargetFlag: command.TargetMaskTest,
6668
}
6769

6870
cmdPhoenix := command.Command{

internal/engine/command/voucher/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
func (v *Voucher) createHandler(cmd command.Command, _ entity.AppID, _ string, args ...string) command.CommandResult {
1414
//! Admin only check
1515

16-
code := utils.RandomString(8, utils.CapitalLetterNumbers)
16+
code := utils.RandomString(8, utils.CapitalAlphanumerical)
1717
for _, err := v.db.GetVoucherByCode(code); err == nil; {
18-
code = utils.RandomString(8, utils.CapitalLetterNumbers)
18+
code = utils.RandomString(8, utils.CapitalAlphanumerical)
1919
}
2020

2121
amount := args[0]

pkg/utils/random.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
)
88

99
const (
10-
Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
11-
Numbers = "0123456789"
12-
CapitalLetterNumbers = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
10+
Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
11+
Numbers = "0123456789"
12+
CapitalAlphanumerical = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1313
)
1414

1515
const (

0 commit comments

Comments
 (0)