working commit

This commit is contained in:
2026-06-08 09:42:32 +02:00
parent 0506b35cd1
commit 5f16f33a8b
21 changed files with 786 additions and 114 deletions
+30 -5
View File
@@ -4,20 +4,45 @@
package account
import (
"context"
"mbase/pkg/client"
"mbase/pkg/mbctl"
"github.com/spf13/cobra"
)
func (util *Util) UpdateAccount(cmd *cobra.Command, args []string) {
//util.updateAccountParams.Filename = args[0]
util.updateAccountParams.Username = args[0]
res, err := util.updateAccount(util.updateAccountParams)
printResponse(res, err)
}
type updateAccountParams struct{}
type updateAccountResult struct{}
type UpdateAccountParams struct {
Username string
NewUsername string
NewPassword string
}
type UpdateAccountResult struct{}
func (util *Util) updateAccount(params updateAccountParams) (updateAccountResult, error) {
func (util *Util) updateAccount(params UpdateAccountParams) (UpdateAccountResult, error) {
var err error
res := updateAccountResult{}
res := UpdateAccountResult{}
grpcConn, cli, err := client.NewClient(&util.access)
if err != nil {
return res, err
}
defer grpcConn.Close()
operParams := &mbctl.UpdateAccountParams{
Username: params.Username,
NewPassword: params.NewPassword,
NewUsername: params.NewUsername,
}
ctx := context.Background()
_, err = cli.UpdateAccount(ctx, operParams)
if err != nil {
return res, err
}
return res, err
}