Giao diện
API · product-attribute
Trang sinh tự động
Parse từ schema.graphql (SDL backend export) bằng parser graphql. Mô tả và quyền lấy nguyên văn từ description trong SDL.
4 query · 11 mutation.
Query
previewProductAttributeMerge
Compatibility, counts, conflicts and the unit / option mapping of a merge (wizard step 3). Requires catalog.write.
query · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
sourceId | ID! | ||
targetId | ID! | ||
optionMap | [ProductAttributeOptionMapInput!] |
Trả về ProductAttributeMergePreview!
| Field | Kiểu | Mô tả |
|---|---|---|
source | ProductAttribute! | |
target | ProductAttribute! | |
compatible | Boolean! | |
block | ProductAttributeMergeBlock | Null when compatible. |
textConversion | Boolean! | Any type -> TEXT: the values become their formatted text (warning). |
affectedProductCount | Int! | Live products holding a source value. |
conflicts | [ProductAttributeMergeConflict!]! | Products holding both: the target value is kept unless conflictChoices says otherwise. |
outOfScopeProducts | [ProductRef!]! | Products whose category scope does not include the target; the merge is refused while any is listed. |
unitsToAdd | [ProductAttributeUnit!]! | Source units the target lacks (unitAdds must list them). |
options | [ProductAttributeMergeOption!]! | SELECT / MULTI_SELECT: each source option with its target match. |
productAttribute
One live attribute (drawer). A deleted or merged one is not_found. Requires catalog.read.
query · quyền: catalog.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
id | ID! |
Trả về ProductAttribute!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
name | String! | 1..50 characters, unique ignoring case in its category branch (ancestors and descendants) or among Chung (R3). |
description | String | At most 500 characters. |
dataType | ProductAttributeDataType! | Immutable once a product holds a value. |
categoryId | ID | Null = Chung (COMMON). |
category | ProductAttributeCategory | |
phase | ProductAttributePhase! | |
inheritedFrom | ProductAttributeCategory | Read for a category with inherited rows or for a product (forProduct): the ancestor it comes from; null for the category's own and for Chung. |
units | [ProductAttributeUnit!]! | NUMBER only: the allowed units, the default first; empty = a number without unit. |
decimals | Int | NUMBER only: 0..4 decimals. |
minValue | Float | NUMBER only, in the default unit (compared on the base value). |
maxValue | Float | |
isRequired | Boolean! | Checked on Lưu sản phẩm (mode != DRAFT) only, never on Lưu nháp or reactivation. |
position | Int! | Order inside its category; seeds the order of required values added on a product form (DEC-OWN28-SPECS-ORDER). |
status | ProductAttributeStatus! | |
options | [ProductAttributeOption!]! | SELECT / MULTI_SELECT: every live option in order, INACTIVE included. |
optionCount | Int! | |
productCount | Int! | Live products holding a value (Số SP; 0 = Chưa dùng). |
possibleDuplicates | [ProductAttributeRef!]! | Live attributes whose name is nearly the same (unaccented, trigram) in the same branch or among Chung (Có thể trùng). |
version | Int! | |
createdAt | DateTime! | |
updatedAt | DateTime! |
productAttributeNameSuggestions
Near-identical names while typing (unaccented, spaces folded, pg_trgm when available), in the scope of categoryId (its branch) plus Chung; excludeId leaves out the attribute being edited. Advisory: the save checks again. limit 1..20, default 5. Requires catalog.write.
query · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
name | String! | ||
categoryId | ID | ||
excludeId | ID | ||
limit | Int | 5 |
Trả về [ProductAttributeSuggestion!]!
| Field | Kiểu | Mô tả |
|---|---|---|
attribute | ProductAttributeRef! | |
exact | Boolean! | Same name_key as the typed name: the form shows Đã có and picks it. |
similarity | Float! | 0..1 similarity of the unaccented names. |
productAttributes
Product attributes (WEB_ADMIN), deleted and merged ones never included, with the chip counts. Without forProduct: the central page and the category tab, ordered by category path, position, then name. pageSize 1..500, default 50. Requires catalog.read.
query · quyền: catalog.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
filter | ProductAttributeFilter | ||
page | Int | 1 | |
pageSize | Int | 50 |
Trả về ProductAttributePage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [ProductAttribute!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! | |
sourceStatus | SourceStatus! | |
counts | ProductAttributeCounts! |
Mutation
addProductAttributeOption
Add an option (drawer, or quick add on the product form, Q4). Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | AddProductAttributeOptionInput! |
Trả về ProductAttributeOptionResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The attribute id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
attribute | ProductAttribute! | |
option | ProductAttributeOption | The added / changed option; null after a delete. |
createProductAttribute
Create an attribute (drawer, or the product form popup: saved at once). Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | CreateProductAttributeInput! |
Trả về ProductAttributeResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False for an edit that changes nothing: no write, same version, no audit row. |
attribute | ProductAttribute! |
deleteProductAttribute
Soft-delete an attribute no product uses (Xoá hẳn; else conflict attribute_in_use). Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | DeleteProductAttributeInput! |
Trả về DeleteProductAttributeResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | Version of the soft-deleted row. |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction |
deleteProductAttributeOption
Remove an option no product uses. Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | DeleteProductAttributeOptionInput! |
Trả về ProductAttributeOptionResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The attribute id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
attribute | ProductAttribute! | |
option | ProductAttributeOption | The added / changed option; null after a delete. |
mergeProductAttribute
Merge source into target in one transaction (design §4): values move (or convert), the source is soft-deleted with merged_into_id = target, one ATTRIBUTE_MERGE history event per affected product. Refused (conflict merge_blocked {block}) when incompatible or a product is outside the target scope. Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | MergeProductAttributeInput! |
Trả về MergeProductAttributeResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The target id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
target | ProductAttribute! | |
affectedProductCount | Int! | Products whose value moved to the target (one ATTRIBUTE_MERGE history event each). |
moveProductAttribute
Chuyển vào ngành hàng / Chuyển thành Chung (name taken: conflict duplicate_name). Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | MoveProductAttributeInput! |
Trả về ProductAttributeResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False for an edit that changes nothing: no write, same version, no audit row. |
attribute | ProductAttribute! |
reorderProductAttributeOptions
Order the options. Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | ReorderProductAttributeOptionsInput! |
Trả về ProductAttributeOptionResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The attribute id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
attribute | ProductAttribute! | |
option | ProductAttributeOption | The added / changed option; null after a delete. |
reorderProductAttributes
Order the attributes of one category (drag and drop). Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | ReorderProductAttributesInput! |
Trả về ReorderProductAttributesResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The category id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
items | [ProductAttribute!]! | The category's attributes in their new order. |
setProductAttributeOptionStatus
Deactivate or reactivate an option. Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | SetProductAttributeOptionStatusInput! |
Trả về ProductAttributeOptionResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The attribute id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
attribute | ProductAttribute! | |
option | ProductAttributeOption | The added / changed option; null after a delete. |
updateProductAttribute
Edit an attribute. Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | UpdateProductAttributeInput! |
Trả về ProductAttributeResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False for an edit that changes nothing: no write, same version, no audit row. |
attribute | ProductAttribute! |
updateProductAttributeOption
Rename an option. Requires catalog.write.
mutation · quyền: catalog.write
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | UpdateProductAttributeOptionInput! |
Trả về ProductAttributeOptionResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The attribute id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
attribute | ProductAttribute! | |
option | ProductAttributeOption | The added / changed option; null after a delete. |