-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-6: Master Bot and Swap configuration API (#16)
- Loading branch information
1 parent
ea339fb
commit 5c3160d
Showing
11 changed files
with
225 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE bots ADD COLUMN is_master_bot TINYINT(1) DEFAULT '0'; | ||
ALTER TABLE bots ADD COLUMN is_swap_enabled TINYINT(1) DEFAULT '0'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
package model | ||
|
||
type Bot struct { | ||
Id int64 `json:"id"` | ||
BotUuid string `json:"botUuid"` | ||
Id int64 `json:"id"` | ||
BotUuid string `json:"botUuid"` | ||
IsMasterBot bool `json:"isMasterBot"` | ||
IsSwapEnabled bool `json:"isSwapEnabled"` | ||
} | ||
|
||
type BotConfigUpdate struct { | ||
IsMasterBot bool `json:"isMasterBot"` | ||
IsSwapEnabled bool `json:"isSwapEnabled"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package service | ||
|
||
import ( | ||
"gitlab.com/open-soft/go-crypto-bot/src/model" | ||
"gitlab.com/open-soft/go-crypto-bot/src/repository" | ||
) | ||
|
||
type BotServiceInterface interface { | ||
IsSwapEnabled() bool | ||
IsMasterBot() bool | ||
} | ||
|
||
type BotService struct { | ||
CurrentBot *model.Bot | ||
BotRepository *repository.BotRepository | ||
} | ||
|
||
func (b *BotService) IsSwapEnabled() bool { | ||
return b.BotRepository.GetCurrentBotCached(b.CurrentBot.Id).IsSwapEnabled | ||
} | ||
|
||
func (b *BotService) IsMasterBot() bool { | ||
return b.BotRepository.GetCurrentBotCached(b.CurrentBot.Id).IsMasterBot | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.