Skip to content

Commit

Permalink
changed the function param type to LocalUser, added Password to Local…
Browse files Browse the repository at this point in the history
…User struct
  • Loading branch information
iljassh committed Mar 3, 2021
1 parent a29bd86 commit 0d87ffe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 6 additions & 4 deletions api/userstore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ func New(api restapi.Connector) *UserStore {
}

// CreateLocalUser create a new local PrivX user
func (store *UserStore) CreateLocalUser(newUser interface{}) error {
req := newUser
func (store *UserStore) CreateLocalUser(newUser LocalUser) (string, error) {
var id struct {
ID string `json:"id"`
}

_, err := store.api.
URL("/local-user-store/api/v1/users").
Post(&req)
Post(newUser, &id)

return err
return id.ID, err
}

// GetLocalUsers get a local user with details
Expand Down
12 changes: 10 additions & 2 deletions api/userstore/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const (

// Params struct for pagination queries.
type Params struct {
Offset string `json:"offset,omitempty"`
Limit string `json:"limit,omitempty"`
Offset string `json:"offset,omitempty"`
Limit string `json:"limit,omitempty"`
Sortdir string `json:"sortdir,omitempty"`
Query string `json:"query,omitempty"`
}

// FilterUser struct for local users queries.
Expand Down Expand Up @@ -89,4 +91,10 @@ type LocalUser struct {
Email string `json:"email,omitempty"`
Telephone string `json:"telephone,omitempty"`
Locale string `json:"locale,omitempty"`
Password Password `json:"password,omitempty"`
}

// Password definition
type Password struct {
Password string `json:"password,omitempty"`
}

0 comments on commit 0d87ffe

Please sign in to comment.