initial commit 2
This commit is contained in:
43
application/applicationservice/applicationservice.go
Normal file
43
application/applicationservice/applicationservice.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package applicationservice
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"bitbucket.org/nemt/nemt-portal-api/application/entitymapping"
|
||||
"bitbucket.org/nemt/nemt-portal-api/application/notificationservice"
|
||||
"bitbucket.org/nemt/nemt-portal-api/domain/service"
|
||||
"bitbucket.org/nemt/nemt-portal-api/infra/config"
|
||||
)
|
||||
|
||||
var (
|
||||
instance *Service
|
||||
once sync.Once
|
||||
)
|
||||
|
||||
// Service holds the domain service repositories
|
||||
type Service struct {
|
||||
Users *userService
|
||||
Rides *rideService
|
||||
Visits *visitService
|
||||
Provider *providerService
|
||||
Notification *notificationService
|
||||
Profile *profileService
|
||||
Organization *organizationService
|
||||
}
|
||||
|
||||
// New returns a new domain Service instance
|
||||
func New(svc *service.Service, mapper *entitymapping.Mapper, notification *notificationservice.Service, cfg *config.Config) *Service {
|
||||
once.Do(func() {
|
||||
instance = &Service{
|
||||
Users: newUserService(svc, mapper),
|
||||
Rides: newRideService(svc, mapper),
|
||||
Visits: newVisitService(svc, mapper),
|
||||
Provider: newProviderService(svc, mapper),
|
||||
Notification: newNotificationService(svc, mapper, notification, cfg),
|
||||
Profile: newProfileService(svc, mapper),
|
||||
Organization: newOrganizationService(svc, mapper),
|
||||
}
|
||||
})
|
||||
|
||||
return instance
|
||||
}
|
||||
Reference in New Issue
Block a user