mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
27 lines
976 B
Go
27 lines
976 B
Go
package purchases
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
middleware "gitlab.com/mbugroup/lti-api.git/internal/middleware"
|
|
controller "gitlab.com/mbugroup/lti-api.git/internal/modules/purchases/controllers"
|
|
service "gitlab.com/mbugroup/lti-api.git/internal/modules/purchases/services"
|
|
user "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"
|
|
)
|
|
|
|
func Routes(router fiber.Router, purchaseService service.PurchaseService, userService user.UserService) {
|
|
ctrl := controller.NewPurchaseController(purchaseService)
|
|
|
|
route := router.Group("/purchases")
|
|
route.Use(middleware.Auth(userService))
|
|
|
|
route.Get("/", ctrl.GetAll)
|
|
route.Get("/:id", ctrl.GetOne)
|
|
route.Post("/", ctrl.CreateOne)
|
|
route.Post("/:id/approvals/staff", ctrl.ApproveStaffPurchase)
|
|
route.Post("/:id/approvals/manager", ctrl.ApproveManagerPurchase)
|
|
route.Post("/:id/receipts", ctrl.ReceiveProducts)
|
|
route.Delete("/:id", ctrl.DeletePurchase)
|
|
route.Delete("/:id/items", ctrl.DeleteItems)
|
|
}
|