wip-flag-migration #28

Merged
Alfred-mk merged 44 commits from wip-flag-migration into master 2024-09-04 11:25:34 +02:00
Showing only changes of commit c365eaa1d1 - Show all commits

View File

@ -140,25 +140,12 @@ func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (r
// sets the default values and flags // sets the default values and flags
func (h *Handlers) CreateAccount(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *Handlers) CreateAccount(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{} res := resource.Result{}
// Preload the required flags // Preload the required flags
flagKeys := []string{"flag_account_created", "flag_account_creation_failed"} flagKeys := []string{"flag_account_created", "flag_account_creation_failed"}
flags, err := h.PreloadFlags(flagKeys) flags, err := h.PreloadFlags(flagKeys)
Alfred-mk marked this conversation as resolved Outdated
Outdated
Review

also seems unnecessary, there should be one single source of flag label to value map.

also seems unnecessary, there should be one single source of flag label to value map.

For clarity, do you mean that we should load all flags once in the menuhandler and have functions access the already loaded flags?

For clarity, do you mean that we should load all flags once in the menuhandler and have functions access the already loaded flags?
Outdated
Review

yes, or perhaps even globally.

yes, or perhaps even globally.
if err != nil { if err != nil {
return res, err return res, err
} }
// err = h.accountFileHandler.EnsureFileExists()
// if err != nil {
// return res, err
// }
// if an account exists, return to prevent duplicate account creation
// existingAccountData, err := h.accountFileHandler.ReadAccountData()
// if existingAccountData != nil {
// return res, err
// }
accountResp, err := h.accountService.CreateAccount() accountResp, err := h.accountService.CreateAccount()
if err != nil { if err != nil {
res.FlagSet = append(res.FlagSet, flags["flag_account_creation_failed"]) res.FlagSet = append(res.FlagSet, flags["flag_account_creation_failed"])
carlos marked this conversation as resolved Outdated
Outdated
Review

please remove commented code if it is not of any more use

please remove commented code if it is not of any more use
@ -493,12 +480,6 @@ func (h *Handlers) CheckAccountStatus(ctx context.Context, sym string, input []b
res.FlagReset = append(res.FlagSet, flags["flag_account_success"]) res.FlagReset = append(res.FlagSet, flags["flag_account_success"])
res.FlagSet = append(res.FlagReset, flags["flag_account_pending"]) res.FlagSet = append(res.FlagReset, flags["flag_account_pending"])
} }
// err = h.accountFileHandler.WriteAccountData(accountData)
// if err != nil {
// return res, err
// }
return res, nil return res, nil
} }
@ -851,7 +832,7 @@ func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []
return res, nil return res, nil
} }
// GetProfileInfo retrieves and formats the profile information of a user from a JSON data file. // GetProfileInfo retrieves and formats the profile information of a user from a Gdbm backed storage.
func (h *Handlers) GetProfileInfo(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *Handlers) GetProfileInfo(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{} res := resource.Result{}