quantityep

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnitFromQuantityInfo

func UnitFromQuantityInfo(q *pb.QuantityInfo) *apiresource.Unit

UnitFromQuantityInfo returns the fully-resolved Unit when the proto carries complete unit detail, or nil otherwise. It never fabricates a placeholder — when only a unit id is available, callers stash the id so the unit is loaded with real data via LoadUnits when ?include= is requested.

Types

type QuantitySvc

type QuantitySvc interface {
	UpdateQuantity(ctx context.Context, req *UpdateQuantityRequest) (*apiresource.Quantity, *apierror.APIError)
}

func NewQuantitySvc

func NewQuantitySvc(config *QuantitySvcConfig) QuantitySvc

type QuantitySvcConfig

type QuantitySvcConfig struct {
	// CoreClient (required) is the core-service gRPC client.
	CoreClient pb.CoreServiceClient
}

type UpdateQuantityEndpoint

type UpdateQuantityEndpoint struct{}

Updates the value or unit of a quantity in place.

A quantity belongs to the resource that reports it — a material's order point, the amount a production step consumes, and so on — so this changes that resource's stored measure directly.

func (*UpdateQuantityEndpoint) Materialize

type UpdateQuantityRequest

type UpdateQuantityRequest struct {
	// Quantity ID.
	QuantityID string `path:"id" validate:"required"`
	// New decimal value for the quantity, as a string to preserve precision.
	Value field.Optional[string] `json:"value,omitzero"`
	// ID of the new unit of measure for the quantity.
	//
	// The stored value is kept as-is and is not converted into the new unit, so send `value` alongside this when the amount should change too.
	UnitID field.Optional[string] `json:"unit_id,omitzero" validate:"omitempty"`
	// ID of the resource that owns this quantity.
	//
	// Used together with `object_type` to verify the owning resource exists; it does not reassign the quantity.
	ObjectID field.Optional[string] `json:"object_id,omitzero" validate:"omitempty"`
	// Type of the resource that owns this quantity.
	//
	// Determines the permission required for the update.
	ObjectType field.Optional[constants.MeasureOwnerType] `json:"object_type,omitzero" validate:"omitempty"`
}

Request to partially update a quantity.

func (*UpdateQuantityRequest) SchemaExample

func (*UpdateQuantityRequest) SchemaExample() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL