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
+17 -5
View File
@@ -31,7 +31,7 @@ type RBACHandler interface {
UpdateRole(c *gin.Context)
DeleteRole(c *gin.Context)
ListRoles(c *gin.Context)
// New methods
GetPermissionsGrouped(c *gin.Context)
CreateOrUpdateRole(c *gin.Context)
@@ -84,23 +84,26 @@ type LetterOutgoingHandler interface {
ListOutgoingLetters(c *gin.Context)
UpdateOutgoingLetter(c *gin.Context)
DeleteOutgoingLetter(c *gin.Context)
SubmitForApproval(c *gin.Context)
ApproveOutgoingLetter(c *gin.Context)
RejectOutgoingLetter(c *gin.Context)
SendOutgoingLetter(c *gin.Context)
ArchiveOutgoingLetter(c *gin.Context)
GetLetterApprovalInfo(c *gin.Context)
AddRecipients(c *gin.Context)
UpdateRecipient(c *gin.Context)
RemoveRecipient(c *gin.Context)
AddAttachments(c *gin.Context)
RemoveAttachment(c *gin.Context)
CreateDiscussion(c *gin.Context)
UpdateDiscussion(c *gin.Context)
DeleteDiscussion(c *gin.Context)
GetApprovalDiscussions(c *gin.Context)
}
type AdminApprovalFlowHandler interface {
@@ -122,3 +125,12 @@ type DispositionRouteHandler interface {
ListByFromDept(c *gin.Context)
SetActive(c *gin.Context)
}
type OnlyOfficeHandler interface {
ProcessCallback(c *gin.Context)
GetEditorConfig(c *gin.Context)
GetOnlyOfficeConfig(c *gin.Context)
LockDocument(c *gin.Context)
UnlockDocument(c *gin.Context)
GetDocumentSession(c *gin.Context)
}
+25
View File
@@ -20,6 +20,7 @@ type Router struct {
letterOutgoingHandler LetterOutgoingHandler
adminApprovalFlowHandler AdminApprovalFlowHandler
dispRouteHandler DispositionRouteHandler
onlyOfficeHandler OnlyOfficeHandler
}
func NewRouter(
@@ -35,6 +36,7 @@ func NewRouter(
letterOutgoingHandler LetterOutgoingHandler,
adminApprovalFlowHandler AdminApprovalFlowHandler,
dispRouteHandler DispositionRouteHandler,
onlyOfficeHandler OnlyOfficeHandler,
) *Router {
return &Router{
config: cfg,
@@ -49,6 +51,7 @@ func NewRouter(
letterOutgoingHandler: letterOutgoingHandler,
adminApprovalFlowHandler: adminApprovalFlowHandler,
dispRouteHandler: dispRouteHandler,
onlyOfficeHandler: onlyOfficeHandler,
}
}
@@ -167,6 +170,7 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
lettersch.POST("/outgoing/:id/reject", r.letterOutgoingHandler.RejectOutgoingLetter)
lettersch.POST("/outgoing/:id/send", r.letterOutgoingHandler.SendOutgoingLetter)
lettersch.POST("/outgoing/:id/archive", r.letterOutgoingHandler.ArchiveOutgoingLetter)
lettersch.GET("/outgoing/:id/approval-info", r.letterOutgoingHandler.GetLetterApprovalInfo)
lettersch.POST("/outgoing/:id/recipients", r.letterOutgoingHandler.AddRecipients)
lettersch.PUT("/outgoing/:id/recipients/:recipient_id", r.letterOutgoingHandler.UpdateRecipient)
@@ -178,6 +182,9 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
lettersch.POST("/outgoing/:id/discussions", r.letterOutgoingHandler.CreateDiscussion)
lettersch.PUT("/outgoing/discussions/:discussion_id", r.letterOutgoingHandler.UpdateDiscussion)
lettersch.DELETE("/outgoing/discussions/:discussion_id", r.letterOutgoingHandler.DeleteDiscussion)
// Get approvals and discussions for outgoing letter
lettersch.GET("/outgoing/:id/approval-discussions", r.letterOutgoingHandler.GetApprovalDiscussions)
lettersch.POST("/dispositions/:letter_id", r.letterHandler.CreateDispositions)
lettersch.GET("/dispositions/:letter_id", r.letterHandler.GetEnhancedDispositionsByLetter)
@@ -212,5 +219,23 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
approvalFlows.POST("/:id/clone", r.adminApprovalFlowHandler.CloneApprovalFlow)
}
}
// OnlyOffice routes
onlyoffice := v1.Group("/onlyoffice")
{
// Callback endpoint - no auth required (OnlyOffice will call this)
onlyoffice.POST("/callback/:key", r.onlyOfficeHandler.ProcessCallback)
// Protected endpoints
onlyofficeAuth := onlyoffice.Group("")
onlyofficeAuth.Use(r.authMiddleware.RequireAuth())
{
onlyofficeAuth.POST("/config", r.onlyOfficeHandler.GetEditorConfig)
onlyofficeAuth.GET("/settings", r.onlyOfficeHandler.GetOnlyOfficeConfig)
onlyofficeAuth.POST("/lock/:id", r.onlyOfficeHandler.LockDocument)
onlyofficeAuth.POST("/unlock/:id", r.onlyOfficeHandler.UnlockDocument)
onlyofficeAuth.GET("/session/:key", r.onlyOfficeHandler.GetDocumentSession)
}
}
}
}