rawlinp commented on a change in pull request #5225:
URL: https://github.com/apache/trafficcontrol/pull/5225#discussion_r514526924
##########
File path: traffic_ops/traffic_ops_golang/servicecategory/servicecategories.go
##########
@@ -112,8 +106,7 @@ func (serviceCategory *TOServiceCategory)
SelectMaxLastUpdatedQuery(where, order
func (serviceCategory TOServiceCategory) Validate() error {
errs := validation.Errors{
- "name": validation.Validate(serviceCategory.Name,
validation.NotNil, validation.Required),
- "tenantId": validation.Validate(serviceCategory.TenantID,
validation.Min(1)),
+ "name": validation.Validate(serviceCategory.Name,
validation.NotNil, validation.Required),
Review comment:
This can just be `validation.NotNil` is redundant when this already has
`validation.Required`.
##########
File path: traffic_ops/traffic_ops_golang/routing/routes.go
##########
@@ -420,7 +420,7 @@ func Routes(d ServerData) ([]Route, []RawRoute,
http.Handler, error) {
//ServiceCategories
{api.Version{3, 0}, http.MethodGet, `service_categories/?$`,
api.ReadHandler(&servicecategory.TOServiceCategory{}), auth.PrivLevelReadOnly,
Authenticated, nil, 1085181543, noPerlBypass},
- {api.Version{3, 0}, http.MethodPut,
`service_categories/{name}/?$`,
api.UpdateHandler(&servicecategory.TOServiceCategory{}),
auth.PrivLevelOperations, Authenticated, nil, 306369141, noPerlBypass},
+ {api.Version{3, 0}, http.MethodPut,
`service_categories/{name}/?$`, servicecategory.Update,
auth.PrivLevelOperations, Authenticated, nil, 306369141, noPerlBypass},
Review comment:
Why was this change necessary? Looking at `servicecategory.Update`, it
doesn't appear to validate or create a changelog entry, both of which this
should be doing via `api.UpdateHandler` already.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]