-
Notifications
You must be signed in to change notification settings - Fork 12
/
services.go
81 lines (72 loc) · 4.75 KB
/
services.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package service
import (
fsc "github.com/openline-ai/openline-customer-os/packages/server/customer-os-common-module/file_store_client"
commonService "github.com/openline-ai/openline-customer-os/packages/server/customer-os-common-module/service"
"github.com/openline-ai/openline-customer-os/packages/server/events-processing-platform/config"
"github.com/openline-ai/openline-customer-os/packages/server/events-processing-platform/domain/common/command"
"github.com/openline-ai/openline-customer-os/packages/server/events-processing-platform/eventstore"
"github.com/openline-ai/openline-customer-os/packages/server/events-processing-platform/logger"
"github.com/openline-ai/openline-customer-os/packages/server/events-processing-platform/repository"
)
type Services struct {
FileStoreApiService fsc.FileStoreApiService
CommonServices *commonService.Services
RequestHandler *requestHandler // generic grpc request handler
//GRPC services
ContactService *contactService
OrganizationService *organizationService
PhoneNumberService *phoneNumberService
EmailService *emailService
UserService *userService
LocationService *locationService
JobRoleService *jobRoleService
InteractionEventService *interactionEventService
InteractionSessionService *interactionSessionService
LogEntryService *logEntryService
IssueService *issueService
CommentService *commentService
OpportunityService *opportunityService
ContractService *contractService
ServiceLineItemService *serviceLineItemService
MasterPlanService *masterPlanService
OrganizationPlanService *organizationPlanService
InvoicingCycleService *invoicingCycleService
InvoiceService *invoiceService
TenantService *tenantService
CountryService *countryService
ReminderService *reminderService
OrderService *orderService
EventStoreService *eventStoreService
}
func InitServices(cfg *config.Config, repositories *repository.Repositories, aggregateStore eventstore.AggregateStore, commandHandlers *command.CommandHandlers, log logger.Logger, ebs *eventstore.EventBufferService) *Services {
services := Services{}
services.FileStoreApiService = fsc.NewFileStoreApiService(&cfg.Services.FileStoreApiConfig)
services.CommonServices = commonService.InitServices(repositories.Drivers.GormDb, repositories.Drivers.Neo4jDriver, cfg.Neo4j.Database, nil)
services.RequestHandler = NewRequestHandler(log, aggregateStore, cfg.Utils)
//GRPC services
services.ContactService = NewContactService(log, commandHandlers.Contact, aggregateStore, cfg)
services.OrganizationService = NewOrganizationService(log, commandHandlers.Organization, aggregateStore, cfg, &services)
services.PhoneNumberService = NewPhoneNumberService(log, repositories.Neo4jRepositories, commandHandlers.PhoneNumber)
services.EmailService = NewEmailService(log, repositories.Neo4jRepositories, commandHandlers.Email)
services.UserService = NewUserService(log, aggregateStore, cfg, commandHandlers.User)
services.LocationService = NewLocationService(log, commandHandlers.Location)
services.JobRoleService = NewJobRoleService(log, commandHandlers.JobRole)
services.InteractionEventService = NewInteractionEventService(log, commandHandlers.InteractionEvent)
services.InteractionSessionService = NewInteractionSessionService(log, commandHandlers.InteractionSession)
services.LogEntryService = NewLogEntryService(log, commandHandlers.LogEntry)
services.IssueService = NewIssueService(log, commandHandlers.Issue)
services.CommentService = NewCommentService(&services, log, aggregateStore, cfg)
services.OpportunityService = NewOpportunityService(log, commandHandlers.Opportunity, aggregateStore, &services)
services.ContractService = NewContractService(log, aggregateStore, &services)
services.ServiceLineItemService = NewServiceLineItemService(log, aggregateStore, &services)
services.MasterPlanService = NewMasterPlanService(log, commandHandlers.MasterPlan, aggregateStore)
services.OrganizationPlanService = NewOrganizationPlanService(log, commandHandlers.OrganizationPlan, aggregateStore)
services.InvoicingCycleService = NewInvoicingCycleService(log, commandHandlers.InvoicingCycle, aggregateStore)
services.InvoiceService = NewInvoiceService(repositories, &services, log, aggregateStore)
services.TenantService = NewTenantService(&services, log, aggregateStore, cfg)
services.CountryService = NewCountryService(&services, log, aggregateStore, cfg)
services.ReminderService = NewReminderService(log, aggregateStore, cfg, ebs)
services.OrderService = NewOrderService(log, aggregateStore, cfg)
services.EventStoreService = NewEventStoreService(&services, log, aggregateStore)
return &services
}