Overview
TheLockerInfo model represents a locker entity in the Locker Management System. It contains information about the locker’s physical characteristics, location, assignment status, and which employee (if any) is currently assigned to it.
Properties
The unique identifier for the locker. This is the primary key and must be unique across all lockers in the system.Validation:
- Required field
- Must be unique (enforced at database level)
The employee number of the person assigned to this locker. This field is nullable and can be empty when the locker is unassigned.Validation:
- Must be unique across all lockers (one employee can only have one locker)
- Can be null or empty string for unassigned lockers
- Setting this field automatically updates
IsEmptytofalse
The size of the locker, represented as an integer value. This typically indicates the physical dimensions or capacity category of the locker.Validation:
- Required field
- Must be a valid integer value
The physical location or area where the locker is situated within the facility.Validation:
- Required field
Indicates whether the locker is currently unassigned and available for use.Behavior:
- Automatically set to
falsewhenEmployeeNumberis provided and not empty - Automatically set to
truewhenEmployeeNumberis empty or null - This field is computed based on the
EmployeeNumbervalue during create and update operations
Example JSON
Assigned Locker
Empty Locker
Validation Rules
The following validation rules are enforced when creating or updating lockers:-
Unique Locker Number: The
LockerNomust be unique across all lockers. Attempting to create a locker with an existing locker number will result in a 400 Bad Request error. -
Unique Employee Assignment: An employee can only be assigned to one locker at a time. If an
EmployeeNumberis already associated with another locker, the operation will fail with a 400 Bad Request error. -
Automatic IsEmpty Calculation: The
IsEmptyfield is automatically calculated based on theEmployeeNumber:- If
EmployeeNumberis not empty:IsEmpty = false - If
EmployeeNumberis empty or null:IsEmpty = true
- If
-
Required Fields: The following fields are required:
LockerNoSizeLocationIsEmpty(automatically computed)
Usage Notes
- When creating a new locker, you don’t need to manually set the
IsEmptyfield as it will be automatically determined based on whether anEmployeeNumberis provided. - The
EmployeeNumberfield can be set to an empty string or null to indicate an unassigned locker. - All lockers are uniquely identified by their
LockerNo, which serves as the primary key.