🛣️ Attribute routes
Attribute routes are SDK composers, not Express middleware. Public reads need no authentication; mutations require an authenticated administrator.
Inventory
| Route | Method / protocol | Path | Schema | Validators | Success status |
|---|---|---|---|---|---|
createAttributeRoute | POST / HTTP | /attributes | createAttributesSchema | isAuthenticated(), checkIdentityType(['admin']) | 201 |
findAttributesRoute | GET / HTTP | /attributes | findAttributesSchema | None | 200 |
getAttributeRoute | GET / HTTP | /attributes/:attributeId | getAttributeSchema | None | 200 |
updateAttributeRoute | PATCH / HTTP | /attributes/:attributeId | updateAttributesSchema | isAuthenticated(), checkIdentityType(['admin']) | 200 |
deleteAttributeRoute | DELETE / HTTP | /attributes/:attributeId | deleteAttributeSchema | isAuthenticated(), checkIdentityType(['admin']) | 204 |
Details
createAttributeRoute
Implementation
Endpoint: POST /attributes
Access: Authenticated administrator: isAuthenticated() then checkIdentityType(['admin']).
Request: Required JSON create body.
Pipeline: createAttributeGroup → getAttributeGroupById → createAttributeGroupTerminator.
Success: 201 and the created group without MongoDB _id.
Failure: Missing/empty body or missing insert result is 400; a failed post-create lookup/terminator is 404; thrown persistence work is 500. Authentication and administrator validation run first.View complete source
findAttributesRoute
Implementation
Endpoint: GET /attributes
Access: Public.
Request: Optional name and pagination query.
Pipeline: findAttributeGroups through withPagination → normalizeAttributesListTerminator.
Success: 200; returns normalized groups, or { data, metadata: { pagination } } when pagination supplies a paginated result.
Failure: Query/database failure or an unexpected list result shape is 500.View complete source
getAttributeRoute
Implementation
Endpoint: GET /attributes/:attributeId
Access: Public.
Request: Required string attributeId path parameter.
Pipeline: getAttributeGroupById → normalizeAttributeGroupTerminator.
Success: 200 and the group without MongoDB _id.
Failure: A missing ID is 400, a missing group is 404, and a thrown query is 500.View complete source
updateAttributeRoute
Implementation
Endpoint: PATCH /attributes/:attributeId
Access: Authenticated administrator: isAuthenticated() then checkIdentityType(['admin']).
Request: Required path/body contract. Only name is schema-supported; the handler also rejects {}.
Pipeline: updateAttributeGroup → getAttributeGroupById → normalizeAttributeGroupTerminator.
Success: 200 and the reloaded normalized group.
Failure: Missing ID/body or an unchanged update is 400; a missing group is 404; a thrown update/reload is 500. Authentication and administrator validation run first.View complete source
deleteAttributeRoute
Implementation
Endpoint: DELETE /attributes/:attributeId
Access: Authenticated administrator: isAuthenticated() then checkIdentityType(['admin']).
Request: Required string attributeId path parameter.
Pipeline: deleteAttributeGroup → deleteAttributeTerminator.
Success: 204 with no response data.
Failure: A missing ID is 400, no matching group is 404, and a false/thrown deletion or missing terminator flag is 500. Authentication and administrator validation run first.View complete source