Property Service
Overview
The Property service manages the catalog's attribute definitions used by products.
A Property describes what kind of attribute exists (e.g. Colour, Material, Voltage) and how it should be treated via DataType.
Actual values assigned to products are stored separately in Product Property Value.
This service allows you to:
- list all available properties
- fetch a property by
IdorCode - create and update property definitions
- delete properties
All operations are tenant-aware and audited.
Endpoints
GET
/api/v1/Property/GetAllProperties
Returns all properties.
Behavior:
- Returns a list of
PropertiesModel - Controller returns
404only if the service returnsnull - Service currently always returns a list (empty list if nothing found), so
404is unlikely
Response:
List<PropertiesModel>
Authorization:
- Requires Bearer Token
GET
/api/v1/Property/GetPropertyById/{id}
Returns a single property by its numeric identifier.
Behavior:
- Looks up property by ID
- Returns
404if not found
Authorization:
- Requires Bearer Token
GET
/api/v1/Property/GetPropertyByCode/{code}
Returns a single property by its code.
Behavior:
- Looks up property by
Code - Returns
404if not found
Authorization:
- Requires Bearer Token
POST
/api/v1/Property/AddNewProperty
Creates a new property definition.
Request body (PropertiesModel):
Name(string, required)Code(string, required)DataType(string, optional)
Behavior:
- Validation is performed in the service layer using
IsReadyToAdd() - Duplicate check is currently based on both
CodeandName:exists = Code == addProperty.Code && Name == addProperty.Name
- If
DataTypeis not provided, it is stored as empty string"" - Successful creation writes an audit log entry
Errors:
- Returns
400if validation - or duplicate exists (per current rule)
Authorization:
- Requires Bearer Token
PUT
/api/v1/Property/UpdatePropertyById/{id}
Updates an existing property definition.
Request:
- Property ID is taken from the route
- Body uses
PropertiesModel
Body fields:
Name(required byIsReadyToUpdate())Code(required byIsReadyToUpdate())DataType(required byIsReadyToUpdate())
Behavior:
- Service requires all fields for update (
IsReadyToUpdate()) - After passing validation, the update logic applies "only non-empty fields" (defensive, but usually redundant because validation requires them)
- Returns
400if property does not exist - Successful update writes an audit log entry
Errors:
- Returns
400if validation - or property does not exist
Authorization:
- Requires Bearer Token
DELETE
/api/v1/Property/DeletePropertyById/{id}
Deletes a property definition by ID.
Behavior:
- Performs a hard delete
- Record is permanently removed from the database
- Successful deletion writes an audit log entry (
LogProductUpdate)
Errors:
- Returns
400if property does not exist or deletion -
Authorization:
- Requires Bearer Token
Notes
- This service defines attribute metadata only (name/code/type).
- Product-specific values are managed in Product Property Value.
- Duplicate protection currently checks
(Code + Name)together - if you want Code to be unique, the rule should be changed. - All state-changing operations are audited.
- Internal errors are logged and not exposed to API consumers.