repository attachment api

This commit is contained in:
efrilm
2025-10-15 21:58:44 +07:00
parent da2246d45a
commit 58128495a6
15 changed files with 606 additions and 64 deletions
+7
View File
@@ -180,3 +180,10 @@ type NotificationHandler interface {
GetCurrentUserSubscriber(c *gin.Context)
UpdateCurrentUserSubscriberChannel(c *gin.Context)
}
type RepositoryAttachmentHandler interface {
CreateAttachment(c *gin.Context)
DeleteAttachment(c *gin.Context)
GetAttachment(c *gin.Context)
ListAttachment(c *gin.Context)
}
+42 -30
View File
@@ -8,21 +8,22 @@ import (
)
type Router struct {
config *config.Config
authHandler AuthHandler
healthHandler HealthHandler
authMiddleware AuthMiddleware
userHandler UserHandler
fileHandler FileHandler
rbacHandler RBACHandler
masterHandler MasterHandler
letterHandler LetterHandler
letterOutgoingHandler LetterOutgoingHandler
adminApprovalFlowHandler AdminApprovalFlowHandler
dispRouteHandler DispositionRouteHandler
onlyOfficeHandler OnlyOfficeHandler
analyticsHandler AnalyticsHandler
notificationHandler NotificationHandler
config *config.Config
authHandler AuthHandler
healthHandler HealthHandler
authMiddleware AuthMiddleware
userHandler UserHandler
fileHandler FileHandler
rbacHandler RBACHandler
masterHandler MasterHandler
letterHandler LetterHandler
letterOutgoingHandler LetterOutgoingHandler
adminApprovalFlowHandler AdminApprovalFlowHandler
dispRouteHandler DispositionRouteHandler
onlyOfficeHandler OnlyOfficeHandler
analyticsHandler AnalyticsHandler
notificationHandler NotificationHandler
repositoryAttachmentHandler RepositoryAttachmentHandler
}
func NewRouter(
@@ -41,23 +42,25 @@ func NewRouter(
onlyOfficeHandler OnlyOfficeHandler,
analyticsHandler AnalyticsHandler,
notificationHandler NotificationHandler,
repositoryAttachmentHandler RepositoryAttachmentHandler,
) *Router {
return &Router{
config: cfg,
authHandler: authHandler,
authMiddleware: authMiddleware,
healthHandler: healthHandler,
userHandler: userHandler,
fileHandler: fileHandler,
rbacHandler: rbacHandler,
masterHandler: masterHandler,
letterHandler: letterHandler,
letterOutgoingHandler: letterOutgoingHandler,
adminApprovalFlowHandler: adminApprovalFlowHandler,
dispRouteHandler: dispRouteHandler,
onlyOfficeHandler: onlyOfficeHandler,
analyticsHandler: analyticsHandler,
notificationHandler: notificationHandler,
config: cfg,
authHandler: authHandler,
authMiddleware: authMiddleware,
healthHandler: healthHandler,
userHandler: userHandler,
fileHandler: fileHandler,
rbacHandler: rbacHandler,
masterHandler: masterHandler,
letterHandler: letterHandler,
letterOutgoingHandler: letterOutgoingHandler,
adminApprovalFlowHandler: adminApprovalFlowHandler,
dispRouteHandler: dispRouteHandler,
onlyOfficeHandler: onlyOfficeHandler,
analyticsHandler: analyticsHandler,
notificationHandler: notificationHandler,
repositoryAttachmentHandler: repositoryAttachmentHandler,
}
}
@@ -236,6 +239,15 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
droutes.PUT("/:id/active", r.dispRouteHandler.SetActive)
}
repoattachsch := v1.Group("/repository-attachments")
repoattachsch.Use(r.authMiddleware.RequireAuth())
{
repoattachsch.POST("", r.repositoryAttachmentHandler.CreateAttachment)
repoattachsch.GET("", r.repositoryAttachmentHandler.ListAttachment)
repoattachsch.DELETE("/:id", r.repositoryAttachmentHandler.DeleteAttachment)
repoattachsch.GET("/:id", r.repositoryAttachmentHandler.GetAttachment)
}
admin := v1.Group("/setting")
admin.Use(r.authMiddleware.RequireAuth())
{