product variant route
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
package processor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"apskel-pos-be/internal/entities"
|
||||
"apskel-pos-be/internal/mappers"
|
||||
"apskel-pos-be/internal/models"
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
@@ -368,6 +367,8 @@ func (p *PurchaseOrderProcessorImpl) UpdatePurchaseOrderStatus(ctx context.Conte
|
||||
return nil, fmt.Errorf("purchase order not found: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println("status:", po.Status)
|
||||
|
||||
// Check if status is changing to "received" and current status is not "received"
|
||||
if status == "received" && po.Status != "received" {
|
||||
// Get purchase order with items for inventory update
|
||||
|
||||
@@ -146,6 +146,7 @@ func NewRouter(cfg *config.Config,
|
||||
spinGameHandler: handler.NewSpinGameHandler(spinGameService),
|
||||
authMiddleware: authMiddleware,
|
||||
customerAuthMiddleware: customerAuthMiddleware,
|
||||
productVariantHandler: handler.NewProductVariantHandler(productVariantService, productVariantValidator),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +271,14 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
|
||||
products.DELETE("/:id", r.productHandler.DeleteProduct)
|
||||
}
|
||||
|
||||
productVariants := protected.Group("/product-variants")
|
||||
{
|
||||
productVariants.POST("", r.productVariantHandler.CreateProductVariant)
|
||||
productVariants.PUT("/:id", r.productVariantHandler.UpdateProductVariant)
|
||||
productVariants.DELETE("/:id", r.productVariantHandler.DeleteProductVariant)
|
||||
productVariants.GET("/:id", r.productVariantHandler.GetProductVariant)
|
||||
}
|
||||
|
||||
inventory := protected.Group("/inventory")
|
||||
inventory.Use(r.authMiddleware.RequireAdminOrManager())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user