Upstream sync
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"bitbucket.org/nemt/nemt-portal-api/domain/entity"
|
||||
)
|
||||
|
||||
@@ -85,3 +87,21 @@ func (s *providerService) GetByNPI(NPI string, user entity.User) (entity.Provide
|
||||
provider.Organization = organization
|
||||
return provider, nil
|
||||
}
|
||||
|
||||
func (s *providerService) GetByOrganization(organizationUUID string, user entity.User) (entity.Provider, error) {
|
||||
organization, err := s.svc.db.Organization().GetByUUID(organizationUUID, user)
|
||||
if err != nil {
|
||||
return entity.Provider{}, err
|
||||
}
|
||||
|
||||
if organization.Type.Key != "provider" {
|
||||
return entity.Provider{}, errors.New("invalid organization")
|
||||
}
|
||||
|
||||
provider, err := s.svc.db.Provider().GetByID(organization.ReferenceID, user)
|
||||
if err != nil {
|
||||
return entity.Provider{}, err
|
||||
}
|
||||
|
||||
return provider, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user