working commit
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
//"fmt"
|
||||
|
||||
//"mstore/app/descr"
|
||||
"mstore/app/operator"
|
||||
"mstore/app/router"
|
||||
)
|
||||
|
||||
// POST /v3/account/create 200 200
|
||||
func (hand *Handler) CreateAccount(rctx *router.Context) {
|
||||
var err error
|
||||
|
||||
params := &operator.CreateAccountParams{}
|
||||
err = rctx.BindJSON(params)
|
||||
if err != nil {
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
res, err := hand.oper.CreateAccount(rctx.Ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("CreateAccount error: %v", err)
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
hand.SendResult(rctx, res)
|
||||
}
|
||||
|
||||
// POST /v3/account/get 200 200
|
||||
func (hand *Handler) GetAccount(rctx *router.Context) {
|
||||
var err error
|
||||
|
||||
params := &operator.GetAccountParams{}
|
||||
err = rctx.BindJSON(params)
|
||||
if err != nil {
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
res, err := hand.oper.GetAccount(rctx.Ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("CreateAccount error: %v", err)
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
hand.SendResult(rctx, res)
|
||||
}
|
||||
|
||||
// POST /v3/accounts/list 200 200
|
||||
func (hand *Handler) ListAccounts(rctx *router.Context) {
|
||||
var err error
|
||||
|
||||
params := &operator.ListAccountsParams{}
|
||||
err = rctx.BindJSON(params)
|
||||
if err != nil {
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
res, err := hand.oper.ListAccounts(rctx.Ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("ListAccounts error: %v", err)
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
hand.SendResult(rctx, res)
|
||||
}
|
||||
|
||||
// POST /v3/account/get 200 200
|
||||
func (hand *Handler) UpdateAccount(rctx *router.Context) {
|
||||
var err error
|
||||
|
||||
params := &operator.UpdateAccountParams{}
|
||||
err = rctx.BindJSON(params)
|
||||
if err != nil {
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
res, err := hand.oper.UpdateAccount(rctx.Ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("UpdateAccount error: %v", err)
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
hand.SendResult(rctx, res)
|
||||
}
|
||||
|
||||
// POST /v3/account/delete 200 200
|
||||
func (hand *Handler) DeleteAccount(rctx *router.Context) {
|
||||
var err error
|
||||
|
||||
params := &operator.DeleteAccountParams{}
|
||||
err = rctx.BindJSON(params)
|
||||
if err != nil {
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
res, err := hand.oper.DeleteAccount(rctx.Ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("DeleteAccount error: %v", err)
|
||||
hand.SendError(rctx, err)
|
||||
return
|
||||
}
|
||||
hand.SendResult(rctx, res)
|
||||
}
|
||||
Reference in New Issue
Block a user