Giao diện
API · sale-admin
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.
7 query · 8 mutation.
Query
saleAffiliateOrders
Danh sach lien ket of one Sale (SL-US-02 AC06, AC07): keyword = part of orderRef or the whole Ma khach hang, any letter case; 10 rows per page by default, 100 at most. Needs sale.read; not_found when no such Sale.
query · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
accountId | ID! | ||
keyword | String | ||
page | Int | 1 | |
pageSize | Int | 10 |
Trả về SaleAffiliateOrderPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [SaleAffiliateOrder!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! | Rows matching the search. |
referredCustomerCount | Int! | So khach gioi thieu: every customer the Sale referred (as on Danh sach gioi thieu), ignoring the search. |
successfulOrderCount | Int | Tong don hang thanh cong: attributed orders in state Hoan tat (same definition as Khach hang); null only when totalsSourceStatus is not READY. |
totalRevenueVnd | VndAmount | Tong doanh thu (VND): sum of the final price of the Hoan tat orders; null when one of them has no final price (revenueSourceStatus UNAVAILABLE), never a partial sum. |
totalsSourceStatus | SaleFieldSourceStatus! | Source of successfulOrderCount. |
revenueSourceStatus | SaleFieldSourceStatus! | Source of totalRevenueVnd. |
totalRewardPoints | Int | Tong diem thuong: credited points of the Sale; null only when rewardSourceStatus is not READY. |
rewardSourceStatus | SaleFieldSourceStatus! | Source of totalRewardPoints and of every row's rewardPoints. |
attributedOrderCount | Int! | Every attributed order of the Sale, whatever its state, ignoring the search. |
customerCount | Int! | Distinct buyers of those orders. |
saleMemberDetail
One Sale (SL-US-02): profile, Hang, both statuses, open ticket, files. Null when no such Sale exists. Needs sale.read; the phone is whole only for sale.manage.
query · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
accountId | ID! |
Trả về SaleMemberDetail
| Field | Kiểu | Mô tả |
|---|---|---|
accountId | ID! | |
saleCode | String! | Ma nhan vien: read-only, issued by the system. |
fullName | String | |
username | String | Ten tai khoan; null for a Sale saved before U6 (the edit asks for it). |
phone | String! | The whole number when the caller holds sale.manage, otherwise the mask. |
phoneIsMasked | Boolean! | |
email | String | |
dateOfBirth | String | Ngay sinh as a calendar date YYYY-MM-DD (no time zone). |
tier | SaleTierRef | Hang: read-only; null while the Sale has none. |
referralCode | String | Ma gioi thieu: made by the system when the Sale is created, read-only (NEW-SL-07); null for a Sale that has none. |
note | String | Ghi chu (at most 500 characters). |
profileImage | SaleMedia | Hinh anh ho so (signed URL); null when there is none. |
profileFiles | [SaleMedia!]! | Tep ho so/hop dong/khac, oldest first (signed URLs). |
ticketStatus | SaleTicketStatus | Read-only. Null when there is no ticket; REJECTED after a Tu choi (Q-1). |
accountStatus | SaleAccountStatus! | |
openTicket | SaleTicket | The open ticket (Cho duyet); null when there is none. |
accountStatusEditable | Boolean! | True when Trang thai tai khoan may be edited: never for Khoi tao (PRD:663). |
version | Int! | Profile version: the expectedVersion of updateSale (0 = no profile row yet). |
createdAt | DateTime! | |
updatedAt | DateTime! | Ngay cap nhat: latest change of the profile, membership or application. |
saleMembers
The Sale list (SL-US-01), ordered by sort (default UPDATED_DESC, most recently updated first; ties by account id), 10 rows per page by default and 100 at most (the screen offers 10/20/50). Needs sale.read (SAL-01); a caller without it is refused.
query · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
filter | SaleMemberFilter | ||
sort | SaleMemberSort | UPDATED_DESC | |
page | Int | 1 | |
pageSize | Int | 10 |
Trả về SaleMemberPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [SaleMember!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! | Rows matching the filter, not the page. |
saleMembership
One Sale's membership, current team and the two versions the commands need. Requires M-05 sale_profile.manage (TEAM CURRENT), the rule of setSaleMembershipStatus: a Sale that does not exist, has no team or is in another manager's team answers forbidden, all alike (never a hint).
query · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
accountId | ID! |
Trả về SaleMembershipRead
| Field | Kiểu | Mô tả |
|---|---|---|
accountId | ID! | |
status | MembershipStatus! | |
version | Int! | APP_SALE membership version: the next expectedVersion of setSaleMembershipStatus. |
teamId | ID | The Sale's current team (always set for a row the caller may read). |
assignmentVersion | Int | Assignment version (history row count): the next expectedVersion of transferSaleTeam. |
saleReferrals
Danh sach gioi thieu of one Sale (SL-US-02 AC05): keyword = Ho va ten (partial, case-insensitive) or the whole Ma khach hang; 10 rows per page by default, 100 at most. Needs sale.read; not_found when no such Sale.
query · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
accountId | ID! | ||
keyword | String | ||
page | Int | 1 | |
pageSize | Int | 10 |
Trả về SaleReferralPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [SaleReferral!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! | Rows matching the search. |
referredCustomerCount | Int! | So khach gioi thieu: every customer the Sale referred, ignoring the search. |
totalRewardPoints | Int | Tong diem thuong: credited points of the Sale; null only when rewardSourceStatus is not READY. |
rewardSourceStatus | SaleFieldSourceStatus! | Source of totalRewardPoints and of every row's rewardPoints. |
saleRejectionReasons
The configured, active rejection reasons by display order (SL-US-04 AC04): five reasons seeded by migration (owner Q-2), no admin screen. Needs sale.review (SAL-03) and a live MFA step-up grant, which it does not spend.
query · SDL không ghi quyền
Không có tham số.
Trả về [SaleRejectionReason!]!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
code | String! | |
label | String! | |
requiresNote | Boolean! | True for the reason "Khac": RejectSaleTicketInput.note is then required. |
saleTierOptions
Hang of the Them nhan vien sale form (SL-US-03 AC01). Needs sale.manage (SAL-02).
query · SDL không ghi quyền
Không có tham số.
Trả về [SaleTierOption!]!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | The tier (createSale.tierId). |
code | String! | |
name | String! |
Mutation
activateSaleMembership
Activate an APPROVED applicant's Sale membership and file its role grant.
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | ActivateSaleMembershipInput! |
Trả về SaleActivationResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The Sale account id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | AWAIT_APPROVAL with the role change request id. |
activation | SaleActivation! |
approveSaleTicket
Approves the open ticket of a Sale (SL-US-04 AC01/AC02/AC06). New account: the ticket becomes Da duyet, the account Dang hoat dong and role sale is granted, in one transaction. Profile update: the new values apply and the account status is kept. Needs sale.review (SAL-03, MFA step-up); never the Sale itself nor the Admin who created it (forbidden, details.reason = self_action). Errors: validation_failed, not_found, stale_version (ticket version), conflict (ticket_not_pending, account_not_active, qualification_not_met, qualification_changed), forbidden (step_up_required with details.action).
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | ApproveSaleTicketInput! |
Trả về SaleTicketResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The Sale's account id. |
version | Int! | The Sale's version after the decision (the next expectedVersion of an edit). |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
member | SaleMemberDetail! | The Sale re-read now: ticket Da duyet / Tu choi (no open ticket), the account status. |
createSale
Creates a Sale (SL-US-03 AC03): Trang thai tai khoan Khoi tao, Trang thai phieu Cho duyet, Ma nhan vien and dates generated; not active until the ticket is approved. A new account gets a login with the phone (not verified; no password is set or sent); an existing account keeps its login. Needs sale.manage (SAL-02). Errors: validation_failed (fieldErrors per field: required / invalid / too_long / taken / too_many / not_editable, media tokens + limits.sizeBytes), conflict (already_sale, NEW-SL-05), forbidden, provider_unknown (retry with the same requestId).
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | CreateSaleInput! |
Trả về SaleCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The Sale's account id. |
version | Int! | The Sale's version after the command (the next expectedVersion). |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when nothing differed (C-03: nothing written, no audit row, version kept). |
member | SaleMemberDetail! | The Sale re-read now (fresh signed URLs, also on a replay). |
rejectSaleTicket
Tu choi the open ticket of a Sale (SL-US-04 AC04/AC05; owner Q-1 PROVISIONAL, reject-outcome.ts). The ticket becomes REJECTED (terminal, it leaves the Cho duyet queue), the account status is kept (a new account stays Khoi tao and not editable), the reason (and note) is recorded, the Sale version moves. Needs sale.review (MFA step-up), never the Sale itself nor the Admin who created it. Errors: validation_failed (reasonId required | unknown, note required | too_long), not_found, stale_version (ticket version), conflict (ticket_not_pending), forbidden.
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | RejectSaleTicketInput! |
Trả về SaleTicketResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The Sale's account id. |
version | Int! | The Sale's version after the decision (the next expectedVersion of an edit). |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
member | SaleMemberDetail! | The Sale re-read now: ticket Da duyet / Tu choi (no open ticket), the account status. |
setSaleAccountStatus
Sets one account status on the Sales ticked on the current page (SL-US-01 AC09). Needs sale.manage (SAL-02). Atomic: an expectedVersion that no longer matches, or an id that is not a Sale, refuses the whole batch with stale_version (details.reason = batch_changed, accountIds) and writes nothing. The caller's own account is refused (forbidden, details.reason = self_action).
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | SetSaleAccountStatusInput! |
Trả về SaleBulkStatusResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The smallest account id of the batch (contract-freeze C-05). |
version | Int! | Version of that Sale after the command. |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when no Sale changed (C-03: nothing written, no audit row). |
items | [SaleBulkItemResult!]! | One row per selected Sale, in account id order. |
updatedCount | Int! | Sales whose status changed (outcome UPDATED). |
skippedCount | Int! | Khoi tao Sales kept as they were (outcome SKIPPED_INITIATED). |
setSaleMembershipStatus
Suspend, lock or reactivate a Sale in the caller's team.
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | SetSaleMembershipStatusInput! |
Trả về SaleMembershipStateResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
membership | SaleMembershipState! |
transferSaleTeam
Move a Sale between two teams the caller manages (effective now).
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | TransferSaleTeamInput! |
Trả về SaleTeamAssignmentResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | NO_CHANGE when the Sale already is in the destination team. |
assignment | SaleTeamAssignment! |
updateSale
Saves the edited basic information of one Sale directly, no ticket (SL-US-02 AC03). Needs sale.manage (SAL-02). Ngay cap nhat moves; Trang thai phieu is not changed. Errors: validation_failed (fieldErrors per field, media tokens, referralCode not_editable), stale_version, not_found, forbidden (self_action on one's own account), conflict account_initiated / phone_change_not_allowed.
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | UpdateSaleInput! |
Trả về SaleCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The Sale's account id. |
version | Int! | The Sale's version after the command (the next expectedVersion). |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when nothing differed (C-03: nothing written, no audit row, version kept). |
member | SaleMemberDetail! | The Sale re-read now (fresh signed URLs, also on a replay). |