refactor(server): correct stale org wording in messages
This commit is contained in:
@@ -83,17 +83,17 @@ func HandleBootstrap(c *gin.Context) {
|
||||
Password string `json:"password"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&body); err != nil || body.InstanceName == "" || body.Email == "" || len(body.Password) < 8 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "org_name, email, and password (>=8 chars) required"})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "instance_name, email, and password (>=8 chars) required"})
|
||||
return
|
||||
}
|
||||
|
||||
orgCount, err := services.CountInstances()
|
||||
instanceCount, err := services.CountInstances()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
var inst *models.Instance
|
||||
switch orgCount {
|
||||
switch instanceCount {
|
||||
case 0:
|
||||
inst, err = services.CreateInstance(body.InstanceName)
|
||||
case 1:
|
||||
@@ -106,7 +106,7 @@ func HandleBootstrap(c *gin.Context) {
|
||||
c.JSON(http.StatusConflict, gin.H{"error": fmt.Sprintf(
|
||||
"cannot bootstrap: %d organizations already exist but no users do; "+
|
||||
"create the owner against the intended inst rather than through setup, "+
|
||||
"or remove the unintended orgs and retry", orgCount)})
|
||||
"or remove the unintended orgs and retry", instanceCount)})
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
@@ -92,7 +92,7 @@ func AdoptInstance(instanceID, name string) (*models.Instance, error) {
|
||||
|
||||
if _, err := db.Col("instances").UpdateOne(ctx, bson.M{"instance_id": instanceID}, bson.M{"$set": set}); err != nil {
|
||||
if mongo.IsDuplicateKeyError(err) {
|
||||
return nil, fmt.Errorf("organization slug already taken")
|
||||
return nil, fmt.Errorf("instance slug already taken")
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func ListMonitors(instanceID string) ([]models.Monitor, error) {
|
||||
|
||||
func ListMonitorsForRunner(instanceID, runner string) ([]models.Monitor, error) {
|
||||
if instanceID == "" {
|
||||
return nil, errors.New("org id required")
|
||||
return nil, errors.New("instance id required")
|
||||
}
|
||||
return listMonitorsForRunner(instanceID, runner)
|
||||
}
|
||||
@@ -227,7 +227,7 @@ func UptimeRollups(instanceID, monitorID string, since time.Time) ([]models.Roll
|
||||
|
||||
func IngestResult(instanceID, runner, monitorID string, res checker.Result) error {
|
||||
if instanceID == "" {
|
||||
return errors.New("org id required")
|
||||
return errors.New("instance id required")
|
||||
}
|
||||
return ingestResult(instanceID, runner, monitorID, res)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user