Add document saved

This commit is contained in:
Aditya Siregar
2025-08-29 16:10:05 +07:00
parent 592fa97be7
commit 2bdce63852
33 changed files with 2862 additions and 132 deletions
+25
View File
@@ -49,6 +49,7 @@ func (a *App) Initialize(cfg *config.Config) error {
letterOutgoingHandler := handler.NewLetterOutgoingHandler(services.letterOutgoingService)
adminApprovalFlowHandler := handler.NewAdminApprovalFlowHandler(services.approvalFlowService)
dispositionRouteHandler := handler.NewDispositionRouteHandler(services.dispositionRouteService)
onlyOfficeHandler := handler.NewOnlyOfficeHandler(services.onlyOfficeService)
a.router = router.NewRouter(
cfg,
@@ -63,6 +64,7 @@ func (a *App) Initialize(cfg *config.Config) error {
letterOutgoingHandler,
adminApprovalFlowHandler,
dispositionRouteHandler,
onlyOfficeHandler,
)
return nil
@@ -181,6 +183,7 @@ type processors struct {
letterOutgoingProcessor *processor.LetterOutgoingProcessorImpl
activityLogger *processor.ActivityLogProcessorImpl
letterNumberGenerator *processor.LetterNumberGeneratorImpl
onlyOfficeProcessor *processor.OnlyOfficeProcessorImpl
}
func (a *App) initProcessors(cfg *config.Config, repos *repositories) *processors {
@@ -215,12 +218,29 @@ func (a *App) initProcessors(cfg *config.Config, repos *repositories) *processor
txMgr,
)
// Create document repositories
docSessionRepo := repository.NewDocumentSessionRepository(a.db)
docVersionRepo := repository.NewDocumentVersionRepository(a.db)
docMetadataRepo := repository.NewDocumentMetadataRepository(a.db)
docErrorRepo := repository.NewDocumentErrorRepository(a.db)
// Create OnlyOffice processor
onlyOfficeProc := processor.NewOnlyOfficeProcessor(
a.db,
docSessionRepo,
docVersionRepo,
docMetadataRepo,
docErrorRepo,
txMgr,
)
return &processors{
userProcessor: processor.NewUserProcessor(repos.userRepo, repos.userProfileRepo),
letterProcessor: letterProc,
letterOutgoingProcessor: letterOutgoingProc,
activityLogger: activity,
letterNumberGenerator: letterNumberGen,
onlyOfficeProcessor: onlyOfficeProc,
}
}
@@ -234,6 +254,7 @@ type services struct {
letterOutgoingService *service.LetterOutgoingServiceImpl
approvalFlowService *service.ApprovalFlowServiceImpl
dispositionRouteService *service.DispositionRouteServiceImpl
onlyOfficeService *service.OnlyOfficeServiceImpl
}
func (a *App) initServices(processors *processors, repos *repositories, cfg *config.Config) *services {
@@ -265,6 +286,9 @@ func (a *App) initServices(processors *processors, repos *repositories, cfg *con
txManager,
)
// Create OnlyOffice service with file storage
onlyOfficeSvc := service.NewOnlyOfficeService(processors.onlyOfficeProcessor, &cfg.OnlyOffice, a.db, s3Client)
return &services{
userService: userSvc,
authService: authService,
@@ -275,6 +299,7 @@ func (a *App) initServices(processors *processors, repos *repositories, cfg *con
letterOutgoingService: letterOutgoingSvc,
approvalFlowService: approvalFlowSvc,
dispositionRouteService: dispRouteSvc,
onlyOfficeService: onlyOfficeSvc,
}
}