working commit
This commit is contained in:
@@ -15,14 +15,20 @@ import (
|
||||
"mstore/app/router"
|
||||
)
|
||||
|
||||
type Response struct {
|
||||
type xxxResponse struct {
|
||||
Error bool `json:"error" yaml:"error"`
|
||||
Message string `json:"message,omitempty" yaml:"message,omitempty"`
|
||||
Result any `json:"result,omitempty" yaml:"result,result"`
|
||||
}
|
||||
|
||||
type GenericResponse[T any] struct {
|
||||
Error bool `json:"error" yaml:"error"`
|
||||
Message string `json:"message,omitempty" yaml:"message,omitempty"`
|
||||
Result T `json:"result,omitempty" yaml:"result,result"`
|
||||
}
|
||||
|
||||
func (hand *Handler) SendResult(rctx *router.Context, result any) {
|
||||
response := &Response{
|
||||
response := &GenericResponse[any]{
|
||||
Error: false,
|
||||
Result: result,
|
||||
}
|
||||
@@ -30,7 +36,7 @@ func (hand *Handler) SendResult(rctx *router.Context, result any) {
|
||||
}
|
||||
|
||||
func (hand *Handler) SendError(rctx *router.Context, err error) {
|
||||
response := &Response{
|
||||
response := &GenericResponse[any]{
|
||||
Error: true,
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ type GetAccountParams struct {
|
||||
AccountID string
|
||||
}
|
||||
type GetAccountResult struct {
|
||||
AccountDescr *descr.AccountShortDescr
|
||||
Account *descr.AccountShortDescr `json:"accountDescr"`
|
||||
}
|
||||
|
||||
func (oper *Operator) GetAccount(ctx context.Context, params *GetAccountParams) (*GetAccountResult, error) {
|
||||
@@ -260,6 +260,6 @@ func (oper *Operator) GetAccount(ctx context.Context, params *GetAccountParams)
|
||||
accountShortDescr.Grants = append(accountShortDescr.Grants, grantShortDescrs)
|
||||
}
|
||||
|
||||
res.AccountDescr = accountShortDescr
|
||||
res.Account = accountShortDescr
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user