working commit
This commit is contained in:
@@ -14,23 +14,23 @@ const (
|
||||
defaultSeedPassword = "mbase"
|
||||
)
|
||||
|
||||
func (lg *Logic) CleanDatabase(ctx context.Context) error {
|
||||
func (oper *Operator) CleanDatabase(ctx context.Context) error {
|
||||
var err error
|
||||
err = lg.db.CleanDatabase(ctx)
|
||||
err = oper.db.CleanDatabase(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (lg *Logic) SeedAccount(ctx context.Context) (string, error) {
|
||||
func (oper *Operator) SeedAccount(ctx context.Context) (string, error) {
|
||||
var err error
|
||||
var accountID string
|
||||
accountDescrs, err := lg.db.ReducedListAccounts(ctx)
|
||||
accountDescrs, err := oper.db.ReducedListAccounts(ctx)
|
||||
if err != nil {
|
||||
return accountID, err
|
||||
}
|
||||
lg.log.Debugf("Seed account")
|
||||
oper.log.Debugf("Seed account")
|
||||
if len(accountDescrs) == 0 {
|
||||
now := time.Now().Format(time.RFC3339)
|
||||
passhash := auxpwd.MakeSHA256Hash([]byte(defaultSeedPassword))
|
||||
@@ -42,7 +42,7 @@ func (lg *Logic) SeedAccount(ctx context.Context) (string, error) {
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
err = lg.db.InsertAccount(ctx, accountDescr)
|
||||
err = oper.db.InsertAccount(ctx, accountDescr)
|
||||
if err != nil {
|
||||
return accountID, err
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func (lg *Logic) SeedAccount(ctx context.Context) (string, error) {
|
||||
Operation: grantType,
|
||||
CreatedAt: now,
|
||||
}
|
||||
err = lg.db.InsertGrant(ctx, grantDescr)
|
||||
err = oper.db.InsertGrant(ctx, grantDescr)
|
||||
if err != nil {
|
||||
return accountID, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user