Refactor inventory commands and queries for improved clarity and consistency
Build and Deploy / build (push) Failing after 2m12s
Build and Deploy / build (push) Failing after 2m12s
- Updated ProductType enum values to be more descriptive (RegularProduct, DiscountProduct). - Removed unnecessary Success and Message properties from response DTOs in AddStock and AdjustStock commands. - Renamed Note property to Reason in AdjustStock and RecordLoss commands, and added ReferenceNumber. - Changed InventoryItemId to Id in UpdateInventorySettingsCommand for consistency. - Updated pagination properties in various queries (PageIndex to Page). - Enhanced GetAllInventoryItemsQuery and GetLowStockItemsQuery to include sorting options. - Updated InventoryProfile mappings to reflect changes in DTOs and Protobuf definitions. - Adjusted Protobuf definitions to align with new property names and structures.
This commit is contained in:
+7
-6
@@ -20,18 +20,19 @@ public class AdjustStockCommandHandler : IRequestHandler<AdjustStockCommand, Adj
|
||||
NewQuantity = request.NewQuantity
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.Note))
|
||||
protoRequest.Reason = request.Note;
|
||||
if (!string.IsNullOrWhiteSpace(request.Reason))
|
||||
protoRequest.Reason = request.Reason;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.ReferenceNumber))
|
||||
protoRequest.ReferenceNumber = request.ReferenceNumber;
|
||||
|
||||
var response = await _context.Inventory.AdjustStockAsync(protoRequest, cancellationToken: cancellationToken);
|
||||
|
||||
return new AdjustStockResponseDto
|
||||
{
|
||||
Success = true,
|
||||
OldQuantity = response.PreviousQuantity,
|
||||
PreviousQuantity = response.PreviousQuantity,
|
||||
NewQuantity = response.NewQuantity,
|
||||
Difference = response.Difference,
|
||||
Message = "تعدیل موجودی با موفقیت انجام شد"
|
||||
Difference = response.Difference
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user