add(not found for schema request)
This commit is contained in:
1 parent
4d6a7a4c0b
commit
0276feb0e7
1 file changed
+9
-1
@@ -1,6 +1,8 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/model"
|
||||
@@ -11,5 +13,11 @@ var Schema = schema{}
|
||||
type schema struct{}
|
||||
|
||||
func (schema) GetByModuleId(request domain.GetByModuleIdRequest) (*entity.ConfigSchema, error) {
|
||||
return model.SchemaRep.GetSchemaByModuleId(request.ModuleId)
|
||||
if response, err := model.SchemaRep.GetSchemaByModuleId(request.ModuleId); err != nil {
|
||||
return nil, err
|
||||
} else if response == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "schema with moduleId %d not found", request.ModuleId)
|
||||
} else {
|
||||
return response, nil
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user