Skip to content

Commit 9b66ae6

Browse files
committed
fix(backend): uniform validation messages
1 parent c67ec5b commit 9b66ae6

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

backend/services/local/organizations.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (s *LocalOrganizationService) CreateDistributor(req *models.CreateLocalDist
5151
if strings.TrimSpace(req.Name) == "" {
5252
validationErrors = append(validationErrors, response.ValidationError{
5353
Key: "name",
54-
Message: "name cannot be empty",
54+
Message: "cannot_be_empty",
5555
Value: req.Name,
5656
})
5757
}
@@ -60,7 +60,7 @@ func (s *LocalOrganizationService) CreateDistributor(req *models.CreateLocalDist
6060
if req.CustomData == nil || req.CustomData["vat"] == nil {
6161
validationErrors = append(validationErrors, response.ValidationError{
6262
Key: "vat",
63-
Message: "vat is required",
63+
Message: "required",
6464
Value: "",
6565
})
6666
} else if vatStr, ok := req.CustomData["vat"].(string); !ok || strings.TrimSpace(vatStr) == "" {
@@ -70,7 +70,7 @@ func (s *LocalOrganizationService) CreateDistributor(req *models.CreateLocalDist
7070
}
7171
validationErrors = append(validationErrors, response.ValidationError{
7272
Key: "vat",
73-
Message: "vat cannot be empty",
73+
Message: "cannot_be_empty",
7474
Value: vatValue,
7575
})
7676
}
@@ -207,7 +207,7 @@ func (s *LocalOrganizationService) CreateReseller(req *models.CreateLocalReselle
207207
if strings.TrimSpace(req.Name) == "" {
208208
validationErrors = append(validationErrors, response.ValidationError{
209209
Key: "name",
210-
Message: "name cannot be empty",
210+
Message: "cannot_be_empty",
211211
Value: req.Name,
212212
})
213213
}
@@ -216,7 +216,7 @@ func (s *LocalOrganizationService) CreateReseller(req *models.CreateLocalReselle
216216
if req.CustomData == nil || req.CustomData["vat"] == nil {
217217
validationErrors = append(validationErrors, response.ValidationError{
218218
Key: "vat",
219-
Message: "vat is required",
219+
Message: "required",
220220
Value: "",
221221
})
222222
} else if vatStr, ok := req.CustomData["vat"].(string); !ok || strings.TrimSpace(vatStr) == "" {
@@ -226,7 +226,7 @@ func (s *LocalOrganizationService) CreateReseller(req *models.CreateLocalReselle
226226
}
227227
validationErrors = append(validationErrors, response.ValidationError{
228228
Key: "vat",
229-
Message: "vat cannot be empty",
229+
Message: "cannot_be_empty",
230230
Value: vatValue,
231231
})
232232
}
@@ -364,7 +364,7 @@ func (s *LocalOrganizationService) CreateCustomer(req *models.CreateLocalCustome
364364
if strings.TrimSpace(req.Name) == "" {
365365
validationErrors = append(validationErrors, response.ValidationError{
366366
Key: "name",
367-
Message: "name cannot be empty",
367+
Message: "cannot_be_empty",
368368
Value: req.Name,
369369
})
370370
}
@@ -373,7 +373,7 @@ func (s *LocalOrganizationService) CreateCustomer(req *models.CreateLocalCustome
373373
if req.CustomData == nil || req.CustomData["vat"] == nil {
374374
validationErrors = append(validationErrors, response.ValidationError{
375375
Key: "vat",
376-
Message: "vat is required",
376+
Message: "required",
377377
Value: "",
378378
})
379379
} else if vatStr, ok := req.CustomData["vat"].(string); !ok || strings.TrimSpace(vatStr) == "" {
@@ -383,7 +383,7 @@ func (s *LocalOrganizationService) CreateCustomer(req *models.CreateLocalCustome
383383
}
384384
validationErrors = append(validationErrors, response.ValidationError{
385385
Key: "vat",
386-
Message: "vat cannot be empty",
386+
Message: "cannot_be_empty",
387387
Value: vatValue,
388388
})
389389
}

0 commit comments

Comments
 (0)