refactor: new persistence, more SQL, less ORM

This commit is contained in:
Deluan
2020-01-28 08:22:17 -05:00
committed by Deluan Quintão
parent b26a5ef2d0
commit 71c1844bca
38 changed files with 1294 additions and 1346 deletions
+8 -6
View File
@@ -110,13 +110,15 @@ func CreateAdmin(ds model.DataStore) func(w http.ResponseWriter, r *http.Request
func createDefaultUser(ctx context.Context, ds model.DataStore, username, password string) error {
id, _ := uuid.NewRandom()
log.Warn("Creating initial user", "user", username)
now := time.Now()
initialUser := model.User{
ID: id.String(),
UserName: username,
Name: strings.Title(username),
Email: "",
Password: password,
IsAdmin: true,
ID: id.String(),
UserName: username,
Name: strings.Title(username),
Email: "",
Password: password,
IsAdmin: true,
LastLoginAt: &now,
}
err := ds.User(ctx).Put(&initialUser)
if err != nil {