77 lines
2.0 KiB
C#
77 lines
2.0 KiB
C#
using Distribution.Models;
|
|
|
|
namespace Distribution.Features.Stock;
|
|
|
|
// Shared pagination wrapper
|
|
public record PagedResponse<T>(int Page, int PageSize, int Total, List<T> Items);
|
|
|
|
// Balance
|
|
public record StockBalanceResponse(
|
|
Guid ItemId,
|
|
string ItemName,
|
|
Guid LocationId,
|
|
LocationType LocationType,
|
|
decimal Quantity,
|
|
DateTime UpdatedAt,
|
|
string LocationName);
|
|
|
|
public record StockTotalResponse(
|
|
Guid ItemId,
|
|
string ItemName,
|
|
decimal TotalQuantity,
|
|
List<StockBalanceResponse> Breakdown);
|
|
|
|
// Movement
|
|
public record StockMovementResponse(
|
|
Guid Id,
|
|
Guid ItemId,
|
|
string ItemName,
|
|
Guid? FromLocationId,
|
|
LocationType? FromLocationType,
|
|
Guid? ToLocationId,
|
|
LocationType? ToLocationType,
|
|
decimal Quantity,
|
|
MovementType Type,
|
|
string? ReasonCode,
|
|
Guid? ReferenceId,
|
|
DateTime CreatedAt,
|
|
Guid CreatedBy,
|
|
string? FromLocationName,
|
|
string? ToLocationName);
|
|
|
|
// Write requests
|
|
public record TransferRequest(
|
|
Guid ItemId,
|
|
Guid FromLocationId,
|
|
LocationType FromLocationType,
|
|
Guid ToLocationId,
|
|
LocationType ToLocationType,
|
|
decimal Quantity,
|
|
Guid? ReferenceId);
|
|
|
|
public record DamageRequest(
|
|
Guid ItemId,
|
|
Guid LocationId,
|
|
LocationType LocationType,
|
|
decimal Quantity,
|
|
string ReasonCode);
|
|
|
|
public record CustomerReturnRequest(
|
|
Guid ItemId,
|
|
Guid VehicleId,
|
|
decimal Quantity,
|
|
Guid? ReferenceId);
|
|
|
|
public record AdjustmentRequest(
|
|
Guid ItemId,
|
|
Guid LocationId,
|
|
LocationType LocationType,
|
|
decimal Quantity,
|
|
string ReasonCode,
|
|
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
|
Guid? AdjustedByUserId = null);
|
|
|
|
// Movements are an immutable ledger — quantity, locations, and type can never change once recorded
|
|
// (the running stock balance is the sum of all movements). Only the free-text reason/note is editable.
|
|
public record UpdateMovementReasonRequest(string ReasonCode);
|