allow cors origin in config file, move resources from user to planet

This commit is contained in:
arnaucube
2019-06-17 18:59:46 +02:00
parent 8064e1d3b7
commit edfa4e6751
10 changed files with 250 additions and 233 deletions

View File

@@ -50,6 +50,9 @@ func (srv Service) Register(name, password, email string) (*models.User, error)
}
_, planet, err := srv.gamesrv.CreatePlanet(user.Id)
if err != nil {
return nil, err
}
user.Planets = append(user.Planets, planet.Id)
user.StoreInDb()
@@ -92,8 +95,7 @@ func (srv Service) GetUserById(userid bson.ObjectId) (*models.User, error) {
return nil, err
}
user := models.UserDbToUser(srv.db, userDb)
_, err = user.GetResources()
return user, err
return user, nil
}
func (srv Service) GetUserPlanetsById(userid bson.ObjectId) ([]*models.Planet, error) {