Upstream sync
This commit is contained in:
@@ -12,6 +12,7 @@ type repoManager interface {
|
||||
Notification() NotificationRepo
|
||||
Profile() ProfileRepo
|
||||
Organization() OrganizationRepo
|
||||
Zipcodes() ZipcodeRepo
|
||||
}
|
||||
|
||||
// UserRepo defines the data set for users
|
||||
@@ -105,3 +106,8 @@ type ProfileRepo interface {
|
||||
GetVisibles(visible bool) ([]entity.Profile, error)
|
||||
GetByOrganizationType(organizationTypeID int64) ([]entity.Profile, error)
|
||||
}
|
||||
|
||||
type ZipcodeRepo interface {
|
||||
GetAll() ([]entity.Zipcode, error)
|
||||
GetByParticipatingZipcode(zipcode string) (entity.Zipcode, error)
|
||||
}
|
||||
|
||||
8
domain/entity/zipcode.go
Normal file
8
domain/entity/zipcode.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package entity
|
||||
|
||||
type Zipcode struct {
|
||||
ID int64 `db:"participating_zip_code_id" json:"-"`
|
||||
UUID string `db:"participating_zip_code_uuid" json:"uuid"`
|
||||
Zipcode string `db:"zipcode" json:"zipcode"`
|
||||
Participating bool `db:"participating" json:"participating"`
|
||||
}
|
||||
@@ -25,6 +25,7 @@ type Service struct {
|
||||
Notification *notificationService
|
||||
Profile *profileService
|
||||
Organization *organizationService
|
||||
Zipcodes *zipcodeService
|
||||
}
|
||||
|
||||
// New returns a new domain Service instance
|
||||
@@ -39,6 +40,7 @@ func New(db contract.DataManager, cache contract.CacheManager, cfg *config.Confi
|
||||
instance.Notification = newNotificationService(instance)
|
||||
instance.Profile = newProfileService(instance)
|
||||
instance.Organization = newOrganizationService(instance)
|
||||
instance.Zipcodes = newZipcodeService(instance)
|
||||
})
|
||||
|
||||
return instance, nil
|
||||
|
||||
25
domain/service/zipcode.go
Normal file
25
domain/service/zipcode.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"bitbucket.org/nemt/nemt-portal-api/domain/entity"
|
||||
)
|
||||
|
||||
// userService is the domain service for user operations
|
||||
type zipcodeService struct {
|
||||
svc *Service
|
||||
}
|
||||
|
||||
// newUserService returns an instance of userService
|
||||
func newZipcodeService(svc *Service) *zipcodeService {
|
||||
return &zipcodeService{
|
||||
svc: svc,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *zipcodeService) GetAll() ([]entity.Zipcode, error) {
|
||||
return s.svc.db.Zipcodes().GetAll()
|
||||
}
|
||||
|
||||
func (s *zipcodeService) GetByParticipatingZipcode(zipcode string) (entity.Zipcode, error) {
|
||||
return s.svc.db.Zipcodes().GetByParticipatingZipcode(zipcode)
|
||||
}
|
||||
Reference in New Issue
Block a user