mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-21 14:44:45 +01:00
use the right struct to create user
This commit is contained in:
@@ -20,17 +20,17 @@ type CreateUserResponseBody struct {
|
|||||||
Login string `json:"login"`
|
Login string `json:"login"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
}
|
}
|
||||||
|
type CreateUserRequestBody struct {
|
||||||
|
Login string `json:"login"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
PartnerID string `json:"partnerid"`
|
||||||
|
AccountType string `json:"accounttype"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateUser : Create user Controller
|
// CreateUser : Create user Controller
|
||||||
func (controller *CreateUserController) CreateUser(c echo.Context) error {
|
func (controller *CreateUserController) CreateUser(c echo.Context) error {
|
||||||
// optional parameters that we currently do not use
|
|
||||||
type RequestBody struct {
|
var body CreateUserRequestBody
|
||||||
Login string `json:"login"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
PartnerID string `json:"partnerid"`
|
|
||||||
AccountType string `json:"accounttype"`
|
|
||||||
}
|
|
||||||
var body RequestBody
|
|
||||||
|
|
||||||
if err := c.Bind(&body); err != nil {
|
if err := c.Bind(&body); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func (suite *CreateUserTestSuite) TestCreateWithProvidedLoginAndPassword() {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
const testLogin = "test login"
|
const testLogin = "test login"
|
||||||
const testPassword = "test password"
|
const testPassword = "test password"
|
||||||
json.NewEncoder(&buf).Encode(&controllers.AuthRequestBody{
|
json.NewEncoder(&buf).Encode(&controllers.CreateUserRequestBody{
|
||||||
Login: testLogin,
|
Login: testLogin,
|
||||||
Password: testPassword,
|
Password: testPassword,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user