refactored logic

This commit is contained in:
0xdcarns
2021-10-26 12:27:29 -04:00
parent d25cc93598
commit 8f72ecbaa0
33 changed files with 985 additions and 1092 deletions

22
logic/users.go Normal file
View File

@@ -0,0 +1,22 @@
package logic
import (
"encoding/json"
"github.com/gravitl/netmaker/database"
"github.com/gravitl/netmaker/models"
)
// GetUser - gets a user
func GetUser(username string) (models.User, error) {
var user models.User
record, err := database.FetchRecord(database.USERS_TABLE_NAME, username)
if err != nil {
return user, err
}
if err = json.Unmarshal([]byte(record), &user); err != nil {
return models.User{}, err
}
return user, err
}