mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat(BE-304): add permission in report and closing
This commit is contained in:
@@ -11,6 +11,9 @@ import (
|
||||
|
||||
expenseRepo "gitlab.com/mbugroup/lti-api.git/internal/modules/expenses/repositories"
|
||||
marketingRepo "gitlab.com/mbugroup/lti-api.git/internal/modules/marketing/repositories"
|
||||
|
||||
rUser "gitlab.com/mbugroup/lti-api.git/internal/modules/users/repositories"
|
||||
sUser "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"
|
||||
)
|
||||
|
||||
type RepportModule struct{}
|
||||
@@ -20,9 +23,11 @@ func (RepportModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *
|
||||
expenseRealizationRepository := expenseRepo.NewExpenseRealizationRepository(db)
|
||||
marketingDeliveryProductRepository := marketingRepo.NewMarketingDeliveryProductRepository(db)
|
||||
approvalRepository := commonRepo.NewApprovalRepository(db)
|
||||
userRepository := rUser.NewUserRepository(db)
|
||||
|
||||
approvalSvc := approvalService.NewApprovalService(approvalRepository)
|
||||
repportService := sRepport.NewRepportService(validate, expenseRealizationRepository, marketingDeliveryProductRepository, approvalSvc)
|
||||
userService := sUser.NewUserService(userRepository, validate)
|
||||
|
||||
RepportRoutes(router, repportService)
|
||||
RepportRoutes(router, userService, repportService)
|
||||
}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package repports
|
||||
|
||||
import (
|
||||
m "gitlab.com/mbugroup/lti-api.git/internal/middleware"
|
||||
controller "gitlab.com/mbugroup/lti-api.git/internal/modules/repports/controllers"
|
||||
repport "gitlab.com/mbugroup/lti-api.git/internal/modules/repports/services"
|
||||
user "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func RepportRoutes(v1 fiber.Router, s repport.RepportService) {
|
||||
func RepportRoutes(v1 fiber.Router, u user.UserService, s repport.RepportService) {
|
||||
ctrl := controller.NewRepportController(s)
|
||||
|
||||
route := v1.Group("/reports")
|
||||
route.Use(m.Auth(u))
|
||||
|
||||
route.Get("/expense", ctrl.GetExpense)
|
||||
route.Get("/marketing", ctrl.GetMarketing)
|
||||
route.Get("/expense", m.RequirePermissions(m.P_ReportExpenseGetAll), ctrl.GetExpense)
|
||||
route.Get("/marketing", m.RequirePermissions(m.P_ReportDeliveryGetAll), ctrl.GetMarketing)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user