-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of bank account
- Loading branch information
Showing
14 changed files
with
1,347 additions
and
478 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package commands | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"connectrpc.com/connect" | ||
"github.com/oxisto/money-gopher/cli" | ||
portfoliov1 "github.com/oxisto/money-gopher/gen" | ||
) | ||
|
||
type BankAccountCmd struct { | ||
Create CreateBankAccountCmd `cmd:"" help:"Creates a new bank account."` | ||
} | ||
|
||
type CreateBankAccountCmd struct { | ||
Name string `help:"The identifier of the portfolio, e.g. mybank/myportfolio" required:""` | ||
DisplayName string `help:"The display name of the portfolio"` | ||
} | ||
|
||
func (cmd *CreateBankAccountCmd) Run(s *cli.Session) error { | ||
res, err := s.PortfolioClient.CreatePortfolio( | ||
context.Background(), | ||
connect.NewRequest(&portfoliov1.CreatePortfolioRequest{ | ||
Portfolio: &portfoliov1.Portfolio{ | ||
Name: cmd.Name, | ||
DisplayName: cmd.DisplayName, | ||
}, | ||
}), | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println(res.Msg) | ||
return nil | ||
} |
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
Oops, something went wrong.