Update Ingredients
This commit is contained in:
parent
5a42523f0f
commit
835097d381
@ -1,6 +1,7 @@
|
||||
package processor
|
||||
|
||||
import (
|
||||
"apskel-pos-be/internal/appcontext"
|
||||
"apskel-pos-be/internal/entities"
|
||||
"apskel-pos-be/internal/mappers"
|
||||
"apskel-pos-be/internal/models"
|
||||
@ -74,9 +75,11 @@ func (p *IngredientProcessorImpl) CreateIngredient(ctx context.Context, req *mod
|
||||
}
|
||||
|
||||
func (p *IngredientProcessorImpl) GetIngredientByID(ctx context.Context, id uuid.UUID) (*models.IngredientResponse, error) {
|
||||
contextInfo := appcontext.FromGinContext(ctx)
|
||||
|
||||
// For now, we'll need to get organizationID from context or request
|
||||
// This is a limitation of the current interface design
|
||||
organizationID := uuid.Nil // This should come from context
|
||||
organizationID := contextInfo.OrganizationID // This should come from context
|
||||
|
||||
ingredient, err := p.ingredientRepo.GetByID(ctx, id, organizationID)
|
||||
if err != nil {
|
||||
@ -157,9 +160,10 @@ func (p *IngredientProcessorImpl) ListIngredients(ctx context.Context, organizat
|
||||
}
|
||||
|
||||
func (p *IngredientProcessorImpl) UpdateIngredient(ctx context.Context, id uuid.UUID, req *models.UpdateIngredientRequest) (*models.IngredientResponse, error) {
|
||||
contextInfo := appcontext.FromGinContext(ctx)
|
||||
// For now, we'll need to get organizationID from context or request
|
||||
// This is a limitation of the current interface design
|
||||
organizationID := uuid.Nil // This should come from context
|
||||
organizationID := contextInfo.OrganizationID // This should come from context
|
||||
|
||||
// Get existing ingredient
|
||||
existingIngredient, err := p.ingredientRepo.GetByID(ctx, id, organizationID)
|
||||
@ -220,9 +224,8 @@ func (p *IngredientProcessorImpl) UpdateIngredient(ctx context.Context, id uuid.
|
||||
}
|
||||
|
||||
func (p *IngredientProcessorImpl) DeleteIngredient(ctx context.Context, id uuid.UUID) error {
|
||||
// For now, we'll need to get organizationID from context or request
|
||||
// This is a limitation of the current interface design
|
||||
organizationID := uuid.Nil // This should come from context
|
||||
contextInfo := appcontext.FromGinContext(ctx)
|
||||
organizationID := contextInfo.OrganizationID
|
||||
|
||||
err := p.ingredientRepo.Delete(ctx, id, organizationID)
|
||||
if err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user