package dto import ( "github.com/Caknoooo/go-gin-clean-starter/database/entities" "github.com/Caknoooo/go-gin-clean-starter/pkg/utils" ) const ( MESSAGE_FAILED_CREATE_INVENTORY_MOVEMENT = "failed create inventory movement" MESSAGE_FAILED_CREATE_INVENTORY_MOVEMENT_LINE = "failed create inventory movement line" MESSAGE_SUCCESS_CREATE_INVENTORY_MOVEMENT = "success create inventory movement" MESSAGE_SUCCESS_CREATE_INVENTORY_MOVEMENT_LINE = "success create inventory movement line" MESSAGE_FAILED_GET_INVENTORY_MOVEMENT = "failed get inventory movement" MESSAGE_SUCCESS_GET_INVENTORY_MOVEMENT = "success get inventory movement" MESSAGE_FAILED_UPDATE_INVENTORY_MOVEMENT = "failed update inventory movement" MESSAGE_FAILED_UPDATE_INVENTORY_MOVEMENT_LINE = "failed update inventory movement line" MESSAGE_SUCCESS_UPDATE_INVENTORY_MOVEMENT = "success update inventory movement" MESSAGE_SUCCESS_UPDATE_INVENTORY_MOVEMENT_LINE = "success update inventory movement line" MESSAGE_FAILED_DELETE_INVENTORY_MOVEMENT = "failed delete inventory movement" MESSAGE_FAILED_DELETE_INVENTORY_MOVEMENT_LINE = "failed delete inventory movement line" MESSAGE_SUCCESS_DELETE_INVENTORY_MOVEMENT = "success delete inventory movement" MESSAGE_SUCCESS_DELETE_INVENTORY_MOVEMENT_LINE = "success delete inventory movement line" MESSAGE_FAILED_GET_DATA_FROM_BODY = "failed get data from body" ) type InventoryMovementCreateRequest struct { // MovementNumber string `json:"movement_number"` MovementDate string `json:"movement_date"` MovementType string `json:"movement_type"` ClientID string `json:"client_id" binding:"required"` Status string `json:"status" binding:"required"` SourceLocationID string `json:"source_location_id"` DestinationLocationID string `json:"destination_location_id"` MovementLines []InventoryMovementLineCreateRequest `json:"movement_lines,omitempty" binding:"dive"` } type InventoryMovementLineCreateRequest struct { MovedQuantity float64 `json:"moved_quantity"` ProductID string `json:"product_id"` StorageID string `json:"storage_id"` ClientID string `json:"client_id"` Status string `json:"status"` } type InventoryMovementUpdateRequest struct { // MovementNumber string `json:"movement_number"` MovementDate string `json:"movement_date"` MovementType string `json:"movement_type"` Status string `json:"status"` } type InventoryMovementLineUpdateRequest struct { MovedQuantity *float64 `json:"moved_quantity"` Status *string `json:"status"` } type InventoryMovementResponse struct { ID string `json:"id"` MovementNumber string `json:"movement_number"` MovementDate string `json:"movement_date"` MovementType string `json:"movement_type"` Status string `json:"status"` ClientID string `json:"client_id"` SourceLocationID string `json:"source_location_id"` DestinationLocationID string `json:"destination_location_id"` } type InventoryMovementLineResponse struct { ID string `json:"id"` MovedQuantity float64 `json:"moved_quantity"` ProductID string `json:"product_id"` StorageID string `json:"storage_id"` ClientID string `json:"client_id"` Status string `json:"status"` } func ToInventoryMovementResponse(e entities.TInventoryMovementEntity) InventoryMovementResponse { return InventoryMovementResponse{ ID: e.ID.String(), MovementNumber: e.MovementNumber, MovementDate: utils.DateTimeToString(e.MovementDate), MovementType: e.MovementType, Status: e.Status, ClientID: e.ClientID.String(), SourceLocationID: e.SourceLocationID.String(), DestinationLocationID: e.DestinationLocationID.String(), } } func ToInventoryMovementLineResponse(e entities.TInventoryMovementLineEntity) InventoryMovementLineResponse { return InventoryMovementLineResponse{ ID: e.ID.String(), MovedQuantity: e.MovedQuantity, ProductID: e.ProductID.String(), StorageID: e.StorageID.String(), ClientID: e.ClientID.String(), Status: e.Status, } }