Update
This commit is contained in:
@@ -91,6 +91,7 @@ type LetterOutgoingHandler interface {
|
||||
SendOutgoingLetter(c *gin.Context)
|
||||
ArchiveOutgoingLetter(c *gin.Context)
|
||||
GetLetterApprovalInfo(c *gin.Context)
|
||||
GetLetterApprovals(c *gin.Context)
|
||||
|
||||
AddRecipients(c *gin.Context)
|
||||
UpdateRecipient(c *gin.Context)
|
||||
@@ -104,6 +105,7 @@ type LetterOutgoingHandler interface {
|
||||
DeleteDiscussion(c *gin.Context)
|
||||
|
||||
GetApprovalDiscussions(c *gin.Context)
|
||||
GetApprovalTimeline(c *gin.Context)
|
||||
}
|
||||
|
||||
type AdminApprovalFlowHandler interface {
|
||||
@@ -134,3 +136,13 @@ type OnlyOfficeHandler interface {
|
||||
UnlockDocument(c *gin.Context)
|
||||
GetDocumentSession(c *gin.Context)
|
||||
}
|
||||
|
||||
type AnalyticsHandler interface {
|
||||
GetDashboard(c *gin.Context)
|
||||
GetLetterVolume(c *gin.Context)
|
||||
GetStatusDistribution(c *gin.Context)
|
||||
GetPriorityDistribution(c *gin.Context)
|
||||
GetDepartmentStats(c *gin.Context)
|
||||
GetMonthlyTrend(c *gin.Context)
|
||||
GetApprovalMetrics(c *gin.Context)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ type Router struct {
|
||||
adminApprovalFlowHandler AdminApprovalFlowHandler
|
||||
dispRouteHandler DispositionRouteHandler
|
||||
onlyOfficeHandler OnlyOfficeHandler
|
||||
analyticsHandler AnalyticsHandler
|
||||
}
|
||||
|
||||
func NewRouter(
|
||||
@@ -37,6 +38,7 @@ func NewRouter(
|
||||
adminApprovalFlowHandler AdminApprovalFlowHandler,
|
||||
dispRouteHandler DispositionRouteHandler,
|
||||
onlyOfficeHandler OnlyOfficeHandler,
|
||||
analyticsHandler AnalyticsHandler,
|
||||
) *Router {
|
||||
return &Router{
|
||||
config: cfg,
|
||||
@@ -52,6 +54,7 @@ func NewRouter(
|
||||
adminApprovalFlowHandler: adminApprovalFlowHandler,
|
||||
dispRouteHandler: dispRouteHandler,
|
||||
onlyOfficeHandler: onlyOfficeHandler,
|
||||
analyticsHandler: analyticsHandler,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +173,8 @@ 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.GET("/outgoing/:id/cta", r.letterOutgoingHandler.GetLetterApprovalInfo)
|
||||
lettersch.GET("/outgoing/:id/approvals", r.letterOutgoingHandler.GetLetterApprovals)
|
||||
|
||||
lettersch.POST("/outgoing/:id/recipients", r.letterOutgoingHandler.AddRecipients)
|
||||
lettersch.PUT("/outgoing/:id/recipients/:recipient_id", r.letterOutgoingHandler.UpdateRecipient)
|
||||
@@ -182,9 +186,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.GET("/outgoing/:id/timeline", r.letterOutgoingHandler.GetApprovalTimeline)
|
||||
|
||||
lettersch.POST("/dispositions/:letter_id", r.letterHandler.CreateDispositions)
|
||||
lettersch.GET("/dispositions/:letter_id", r.letterHandler.GetEnhancedDispositionsByLetter)
|
||||
@@ -225,7 +229,7 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
|
||||
{
|
||||
// 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())
|
||||
@@ -237,5 +241,18 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
|
||||
onlyofficeAuth.GET("/session/:key", r.onlyOfficeHandler.GetDocumentSession)
|
||||
}
|
||||
}
|
||||
|
||||
// Analytics routes
|
||||
analytics := v1.Group("/analytics")
|
||||
analytics.Use(r.authMiddleware.RequireAuth())
|
||||
{
|
||||
analytics.GET("/dashboard", r.analyticsHandler.GetDashboard)
|
||||
analytics.GET("/volume", r.analyticsHandler.GetLetterVolume)
|
||||
analytics.GET("/status-distribution", r.analyticsHandler.GetStatusDistribution)
|
||||
analytics.GET("/priority-distribution", r.analyticsHandler.GetPriorityDistribution)
|
||||
analytics.GET("/department-stats", r.analyticsHandler.GetDepartmentStats)
|
||||
analytics.GET("/monthly-trend", r.analyticsHandler.GetMonthlyTrend)
|
||||
analytics.GET("/approval-metrics", r.analyticsHandler.GetApprovalMetrics)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user