Skip to content

API · customer ​

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.

8 query · 6 mutation.

Query ​

customer ​

One customer (not found and out of scope look the same). Requires customer.read.

query · quyền: customer.read

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

Trả về Customer!

FieldKiểuMô tả
accountIdID!The User App account id (the customer is the account; no copy is kept).
customerCodeStringRule #13 code. Null until registration generates it (GAP-CUST-CODE).
fullNameStringProfile name (null until the customer sets one).
phoneMaskedStringAlways the database mask; null for an email-only customer (PPI-P3-01).
groupCustomerGroupRefNull only while no customer group exists yet.
statusCustomerStatus!
accountLockedBoolean!Locked or suspended at account level: status cannot be changed here.
isSaleBoolean!Also a Sale whose Sale account is ACTIVE or LOCKED (Rule #1, #299); the code is in sale.
descriptionString
tags[String!]!
joinedAtDateTime!
versionInt!
updatedAtDateTimeLast Admin edit; null if never edited.
purchaseCustomerPurchase!
debtCustomerDebt!
pointBalancePointBalance!KH-US-03 "Pi-Point hiện tại": read from PiPoint (external) on every request through the bounded per-request port (U6-P3-33), never stored, summed or computed in PIDEAL. Provider figures as reported (GAP-05, decided Q-4: PIDEAL adds and subtracts nothing; available is the figure shown as "Pi-Point hiện tại"). NOT_LINKED differs from 0; a provider failure is UNAVAILABLE, an answer that cannot be read has sourceStatus UNKNOWN: no number in either case, never 0.
addresses[CustomerAddress!]!Every live delivery address (KH-US-03 AC10), the default first, read only (Rule #4: no add, edit or delete on the Admin Portal). recipientPhone and addressLine are full for a caller holding customer.pii.read (piiMasked false), masked otherwise; province, district and ward are readable. Same customer.read as the parent.
openOrderCountInt!Orders not in a terminal state (deposit pending, placed, locked): the N of the lock banner (KH-US-03 AC19). A real 0 means none; a read that cannot be answered is an error, never 0.
phoneStringDisplay phone (0 + 9 digits for +84, else E.164): the full number for a caller holding customer.pii.read (O-05), otherwise the database mask; null for an email-only customer (PPI-P3-01, E-01).
piiMaskedBoolean!True when the caller lacks customer.pii.read: phone, login email and address lines are masked, profile email and date of birth are null.
emailStringUser App profile (contact) email; null when not declared. Kept apart from loginEmail (B-05).
loginEmailStringLogin email (the PiPoint identity, B-05; PPI-P3-07): in full for a caller holding customer.pii.read (O-05), otherwise the database mask (n***@domain); null for an account without one.
dateOfBirthStringCalendar date YYYY-MM-DD (no time zone); null when not declared.
genderCustomerGenderNull when not declared.
referralCodeStringReferral code from the profile (read only; attribution is not rewritten).
saleCustomerSaleRefSet when the customer is also a Sale whose Sale account is ACTIVE or LOCKED (Rule #1, #299); null for a pending or rejected applicant or a suspended Sale.
defaultAddressCustomerAddressThe live address flagged default; null when there is none.
tierCustomerTierNull when Loyalty holds no Tier for the customer.

customerColumnPreference ​

The calling Admin's customer-list columns, or the default when none are saved (AC16, AC20). Requires customer.read.

query · quyền: customer.read

Không có tham số.

Trả về CustomerColumnPreference!

FieldKiểuMô tả
columns[CustomerColumn!]!Visible columns in the fixed order; CODE, NAME and PHONE always included.
isDefaultBoolean!The columns are the default set: CODE, NAME, PHONE, GROUP, DEBT, ORDER_COUNT, TOTAL_SPEND, STATUS (AC19).
updatedAtDateTimeLast save of this Admin; null while nothing is saved (the default applies).

customerGroupAvailability ​

Code/name already used by another live group (deleted groups do not count). Requires customer_group.write.

query · quyền: customer_group.write

Tham sốKiểuMặc địnhMô tả
codeString
nameString
excludeIdID

Trả về CustomerGroupAvailability!

FieldKiểuMô tả
codeTakenBoolean!A live group other than excludeId has this code (trim, case-insensitive); false when not asked.
nameTakenBoolean!A live group other than excludeId has this name (trim, case-insensitive); false when not asked.

customerGroups ​

Live customer groups with their counts (NK-US-01); search is partial and case-insensitive on the name only. 50 rows per page by default, up to 500. Order by "sort" (default CREATED_ASC: oldest first, NEW-NK-01 owner-accepted 2026-10-09), then id. Requires customer_group.read.

query · quyền: customer_group.read

Tham sốKiểuMặc địnhMô tả
searchString
sortCustomerGroupSortCREATED_ASC
pageInt1
pageSizeInt50

Trả về CustomerGroupPage!

FieldKiểuMô tả
items[CustomerGroup!]!
pageInt!
pageSizeInt!
totalInt!
sourceStatusSourceStatus!
defaultGroupCustomerGroupThe current default group, whatever the search and page; null only if the seeded default group was removed by hand; the migration seeds MAC_DINH (U6-P7-67, Q-9).

customerOrders ​

Purchase history of one customer (KH-US-03 AC07): every status, newest creation first; the default page of 5 is the detail block. Unknown, not a User App customer (Rule #1) and out of scope look the same (not_found). Requires customer.read.

query · quyền: customer.read

Tham sốKiểuMặc địnhMô tả
accountIdID!
pageInt1
pageSizeInt5

Trả về CustomerOrderPage!

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

customers ​

User App customers only (Rule #1), all filter conditions AND. Order by "sort" (default JOINED_DESC: newest join first, KH-US-01 AC01), ties by account id. pageSize 1..500, default 50 (Rule #7). Requires customer.read; personal data in full needs customer.pii.read.

query · quyền: customer.read

Tham sốKiểuMặc địnhMô tả
filterCustomerFilterInput
sortCustomerSortJOINED_DESC
pageInt1
pageSizeInt50

Trả về CustomerPage!

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

customerTierOptions ​

U6-P3-28 Tier filter options: USER Tiers in force (Loyalty), Standard included, by rank. Requires customer.read.

query · quyền: customer.read

Không có tham số.

Trả về [CustomerTierOption!]!

FieldKiểuMô tả
tierIdID!
nameString!
rankOrderInt!

provinces ​

U6-P3-28 Province / City catalogue of the address filter: the 34 provincial-level units, by name (NEW-KH-13, Q-11). Requires customer.read.

query · quyền: customer.read

Không có tham số.

Trả về [Province!]!

FieldKiểuMô tả
codeString!
nameString!

Mutation ​

deleteCustomerGroup ​

Soft-delete a non-default group after moving its customers to the default (NKH-US-03).

mutation · SDL không ghi quyền

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

Trả về DeleteCustomerGroupResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
movedCountInt!Customers moved to the default group before the delete (NKH-US-03 AC02).
defaultGroupIdID!

exportCustomers ​

Export every customer matching the filter (all pages, 21 columns, personal data in full) as a private .xlsx (KH-US-02). Requires customer.export (MFA step-up) and customer.pii.read; no match creates no file and no log.

mutation · quyền: customer.export

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

Trả về ExportCustomersResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
rowCountInt!0 with file null: nothing matched and nothing was created (AC05).
fileCustomerExportFile

saveCustomer ​

Edit group/status/description/tags of one customer (KH-US-03).

mutation · SDL không ghi quyền

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

Trả về SaveCustomerResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when nothing differed and nothing was written (AC24).
customerCustomer!

saveCustomerColumnPreference ​

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

mutation · quyền: customer.read

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

Trả về SaveCustomerColumnPreferenceResult!

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.
preferenceCustomerColumnPreference!

saveCustomerGroup ​

Create or edit a customer group, optionally making it the default (NKH-US-02).

mutation · SDL không ghi quyền

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

Trả về SaveCustomerGroupResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when an edit equals the stored group: nothing written, no audit row (U6-P3-36).
groupCustomerGroup!

transferCustomerGroup ​

Move customers to one group, all or nothing (KH-US-01).

mutation · SDL không ghi quyền

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

Trả về TransferCustomerGroupResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
transferredCountInt!
customers[TransferredCustomer!]!

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17