refactor: simplify dataset initialization
This commit is contained in:
@@ -5,10 +5,11 @@ import "gorm.io/gorm"
|
||||
// New initializes the default database records.
|
||||
func New(database *gorm.DB) error {
|
||||
return database.Transaction(func(tx *gorm.DB) error {
|
||||
if err := InitUser(tx); err != nil {
|
||||
user, err := InitUser(tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := InitDataset(tx); err != nil {
|
||||
if err := InitDataset(tx, user.ID, user.Identity); err != nil {
|
||||
return err
|
||||
}
|
||||
return InitExpert(tx)
|
||||
|
||||
Reference in New Issue
Block a user