Skip to content

API · product ​

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.

10 query · 7 mutation.

Query ​

deletedProducts ​

Soft-deleted products only (WEB_ADMIN, ADD-SP-03); never a live row. Search is partial and case-insensitive on name, SKU and barcode; type and the deletedAt range (inclusive) combine with AND. Order by "sort" (default DELETED_AT_DESC), ties by id. pageSize 1..500, default 50. Requires the same permission as deleting a product (catalog.write).

query · SDL không ghi quyền

Tham sốKiểuMặc địnhMô tả
searchString
typeProductType
deletedFromDateTime
deletedToDateTime
sortDeletedProductSortDELETED_AT_DESC
pageInt1
pageSizeInt50

Trả về DeletedProductPage!

FieldKiểuMô tả
items[DeletedProduct!]!
pageInt!
pageSizeInt!
totalInt!
sourceStatusSourceStatus!

product ​

One product for the detail/edit screen (SP-US-03): every field, creator and last editor with their names, usage and (campaign domain) joined Group Buys. A deleted one is not_found (reason deleted). Requires catalog.read.

query · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
idID!

Trả về Product!

FieldKiểuMô tả
idID!
typeProductType!
skuString!Business code (unique, case-insensitive, editable); links use id.
nameStringNull only for a legacy Draft saved without a name.
categoryIdID
categoryPath[String!]!Category names from the root down to the assigned leaf.
brandIdID
brandNameString
tagString
barcodeString
unitString
lengthFloat
widthFloat
heightFloat
dimensionUnitDimensionUnit
weightFloat
weightUnitWeightUnit
requiresInstallationBoolean!
descriptionStringRich text: sanitized Tiptap JSON text (older plain text comes wrapped).
statusProductStatus!
components[ComboComponent!]!Combo only; immutable after creation.
images[ProductImage!]!
usageProductUsage!
versionInt!
createdAtDateTime!
createdByID!
createdByNameStringCreator's name (Người tạo); null when that Admin has no name (shown as —).
updatedAtDateTime!Last update time (Cập nhật lần cuối).
updatedByID!
updatedByNameStringLast editor's name (bởi [tên Admin]); null when that Admin has no name.
unitIdIDThe linked unit (ProductUnit.id); null: no unit, or a legacy text not linked to a unit.
unitNameStringCurrent name of the linked unit; unit carries the label to show (unitName, else the legacy text).
unitStatusProductUnitStatusStatus of the linked unit; null when unitId is null.
shortNameStringTên rút gọn (<= 30 characters).
shortDescriptionStringMô tả ngắn (<= 100 characters).
isGenuineBoolean!Hàng chính hãng (default false).
accessories[ProductAccessory!]!In position order (<= 10).
specs[ProductSpec!]!Display order of this product, as last saved (the order of the specs list sent; DEC-OWN28-SPECS-ORDER).
joinedCampaigns[ProductCampaign!]!Campaigns using this product; empty unless the caller manages the catalog.

productBulkPreview ​

The SP-US-04 popup before confirming (also for one product, ids: [id]): each selected live product with its verdict for the action and the unfinished Campaigns / live Combos holding it by name; deleted or unknown ids as missingIds. 1..500 distinct ids (validation_failed ids: empty|max_items|duplicate). Reads only. Requires catalog.read.

query · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
actionProductStatusAction!
ids[ID!]!

Trả về ProductBulkPreview!

FieldKiểuMô tả
items[ProductBulkPreviewItem!]!The selected live products, in the order asked.
eligibleCountInt!Items with verdict ELIGIBLE (the count on the confirm button; 0 disables it).
missingIds[ID!]!Selected ids that do not exist or are deleted, in the order asked.

productCodeAvailability ​

Duplicate check while typing / on blur (SP-US-02 AC01, SP-US-03 AC05): case-insensitive, trimmed; excludeId leaves out the product being edited. A SKU is TAKEN by any product, deleted included (Q-6); a barcode by any product not deleted (On sale, Draft or Discontinued: NEW-SP-09, B03). Advisory only: saveProduct checks again before writing (Rule #10). Requires catalog.write.

query · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
fieldProductCodeField!
valueString!
excludeIdID

Trả về ProductCodeAvailability!

FieldKiểuMô tả
fieldProductCodeField!
valueString!The checked value after trimming.
statusProductCodeStatus!

productColumnPreference ​

The calling Admin's product-list columns, or the default when none are saved. Requires catalog.read.

query · quyền: catalog.read

Không có tham số.

Trả về ProductColumnPreference!

FieldKiểuMô tả
columns[ProductColumn!]!Visible columns in the fixed order; SKU and NAME always included.
isDefaultBoolean!The columns are the default set: the first 8 (SKU, BARCODE, NAME, TYPE, CATEGORY, BRAND, CREATED_AT, STATUS).
updatedAtDateTimeLast save of this Admin; null while nothing is saved (the default applies).

productComponentSearch ​

Products that may be added to a combo (SP-US-02 AC04-AC06): standard, On sale, not deleted (never a combo, a draft or a discontinued one), whose name or SKU contains the keyword (case-insensitive, partial; not barcode or tag). The keyword is trimmed and needs at least 3 characters (validation_failed search:min_length). The client searches on Enter or the search icon only. Requires catalog.write.

query · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
searchString!

Trả về ProductComponentSearchResult!

FieldKiểuMô tả
items[ProductRef!]!Live On sale standard products, by SKU then id; at most 20.
hasMoreBoolean!True when more than 20 products matched (ask for more characters).

productHistory ​

Change events of one product, newest first (occurredAt, ties by sequence), last 24 months only (retention). Requires catalog.read; unknown product is not_found, a deleted product's history stays readable. pageSize 1..100, default 20.

query · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
productIdID!
filterProductHistoryFilter
pageInt1
pageSizeInt20

Trả về ProductHistoryPage!

FieldKiểuMô tả
items[ProductHistoryEvent!]!
pageInt!
pageSizeInt!
totalInt!Events matching the filter (header 'N su kien').
sourceStatusSourceStatus!

productHistoryActors ​

Admins who changed the product (unfiltered, for the actor filter). Requires catalog.read.

query · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
productIdID!

Trả về [ProductHistoryActor!]!

FieldKiểuMô tả
idID!
nameString
eventCountInt!

productHistoryRecent ​

The latest events of a product (detail card, default 4, at most 20). Requires catalog.read.

query · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
productIdID!
limitInt4

Trả về [ProductHistoryEvent!]!

FieldKiểuMô tả
idID!
productIdID!
skuAtEventString!The SKU as it was when the event happened (SKU can be edited).
typeProductHistoryEventType!
sourceProductHistorySource!
occurredAtDateTime!
actorIdID!
actorNameStringThe Admin's name; null when the Admin has no name (never a phone or an id).
operationString!
requestIdID!
correlationIdID!
versionBeforeInt
versionAfterInt!
sourceRefProductHistorySourceRef!
summaryProductHistorySummary
changes[ProductHistoryChange!]!
valuesMaskedBoolean!Old/new values of this event were masked for the caller.

products ​

Products (WEB_ADMIN, SP-US-01), deleted ones never included. Search is partial and case-insensitive on name, SKU, barcode and tag (the client sends the keyword the Admin committed with Enter); filters combine with AND; category includes its descendants; an absent filter means all (no default status); createdFrom/createdTo are inclusive. Order by "sort" (default UPDATED_DESC: newest update first), ties by id (stable pages). pageSize 1..500, default 50 (the screen offers 50/100/500). Requires catalog.read.

query · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
searchString
categoryIdID
brandIdID
typeProductType
statusProductStatus
createdFromDateTime
createdToDateTime
sortProductSortUPDATED_DESC
pageInt1
pageSizeInt50

Trả về ProductPage!

FieldKiểuMô tả
items[Product!]!
pageInt!
pageSizeInt!
totalInt!
sourceStatusSourceStatus!

Mutation ​

bulkRestoreProducts ​

Restore 1..500 deleted products in ONE transaction, all or nothing: one stale, missing or non-restorable item refuses the batch and nothing is written; details name the ids. Requires catalog.write.

mutation · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
inputBulkRestoreProductsInput!

Trả về BulkRestoreProductsResult!

FieldKiểuMô tả
aggregateIdID!The requestId: a batch has no single aggregate.
versionInt!Always 1.
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when every item was already live: no write, no audit row.
restoredIds[ID!]!Ids restored by this command.
items[RestoreItemResult!]!One entry per requested item, in id order.

bulkSetProductStatus ​

Discontinue, reactivate or delete the selected products in ONE transaction: verdicts are recomputed under row locks and only ELIGIBLE products change; the rest are skipped with their current verdict. A deleted or unknown id refuses the batch (stale_version, reason batch_changed) and nothing is written. Requires catalog.write.

mutation · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
inputBulkSetProductStatusInput!

Trả về BulkSetProductStatusResult!

FieldKiểuMô tả
aggregateIdID!The requestId: a batch has no single aggregate.
versionInt!Always 1.
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when nothing was eligible: no write, no audit row.
processedIds[ID!]!Products changed, by id.
skipped[ProductBulkSkipped!]!Products not changed, by id.

exportProductHistory ​

Export the change history of one product (the page filters, newest first, last 24 months) as a private .xlsx. Requires catalog.history.export (super_admin) and an MFA step-up (forbidden, details.reason step_up_required and details.action catalog_history.export until verified; then repeat the same requestId). Old/new values are masked unless the caller holds audit.read. More than 10,000 lines is conflict/export_too_many_rows; a file over the storage cap is conflict/export_too_large; unknown product is not_found.

mutation · quyền: catalog.history.export

Tham sốKiểuMặc địnhMô tả
inputExportProductHistoryInput!

Trả về ExportProductHistoryResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
rowCountInt!Lines of the file (one per changed field; a creation is one line). 0 with file null: nothing matched, no file.
eventCountInt!Events behind those lines.
fileProductExportFile

restoreProduct ​

Restore one soft-deleted product as Ngừng bán. Requires catalog.write (the Delete permission). A product that is already live is a no-op (ALREADY_LIVE). Errors: not_found, stale_version, validation_failed (details.reason combo_components_required | name_required).

mutation · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
inputRestoreProductInput!

Trả về RestoreProductResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when the product was already live: no write, no audit row.
itemRestoreItemResult!

saveProduct ​

Create (Save draft / Save product) or edit a product. Requires catalog.write.

mutation · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
inputSaveProductInput!

Trả về SaveProductResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False for an edit that changes nothing: no write, same version, no audit row.
productProduct!

saveProductColumnPreference ​

Save the calling Admin's product-list columns ("Áp dụng"; "Đặt lại mặc định" then "Áp dụng" saves the default set). Last write wins per account; not audited (personal display setting). Requires catalog.read.

mutation · quyền: catalog.read

Tham sốKiểuMặc địnhMô tả
inputSaveProductColumnPreferenceInput!

Trả về SaveProductColumnPreferenceResult!

FieldKiểuMô tả
aggregateIdID!The Admin account id (one configuration per Admin).
versionInt!Version of the stored configuration; 0 while nothing is stored.
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when the columns equal what already applies: nothing written.
preferenceProductColumnPreference!

setProductStatus ​

Discontinue, reactivate or delete a product. Requires catalog.write.

mutation · quyền: catalog.write

Tham sốKiểuMặc địnhMô tả
inputSetProductStatusInput!

Trả về SetProductStatusResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
productStatusProductStatus!
isDeletedBoolean!
productProductNull after DELETE (a deleted product is not readable).

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17