Skip to content

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ểuMặc địnhMô tả
accountIdID!
keywordString
pageInt1
pageSizeInt10

Trả về SaleAffiliateOrderPage!

FieldKiểuMô tả
items[SaleAffiliateOrder!]!
pageInt!
pageSizeInt!
totalInt!Rows matching the search.
referredCustomerCountInt!So khach gioi thieu: every customer the Sale referred (as on Danh sach gioi thieu), ignoring the search.
successfulOrderCountIntTong don hang thanh cong: attributed orders in state Hoan tat (same definition as Khach hang); null only when totalsSourceStatus is not READY.
totalRevenueVndVndAmountTong 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.
totalsSourceStatusSaleFieldSourceStatus!Source of successfulOrderCount.
revenueSourceStatusSaleFieldSourceStatus!Source of totalRevenueVnd.
totalRewardPointsIntTong diem thuong: credited points of the Sale; null only when rewardSourceStatus is not READY.
rewardSourceStatusSaleFieldSourceStatus!Source of totalRewardPoints and of every row's rewardPoints.
attributedOrderCountInt!Every attributed order of the Sale, whatever its state, ignoring the search.
customerCountInt!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ểuMặc địnhMô tả
accountIdID!

Trả về SaleMemberDetail

FieldKiểuMô tả
accountIdID!
saleCodeString!Ma nhan vien: read-only, issued by the system.
fullNameString
usernameStringTen tai khoan; null for a Sale saved before U6 (the edit asks for it).
phoneString!The whole number when the caller holds sale.manage, otherwise the mask.
phoneIsMaskedBoolean!
emailString
dateOfBirthStringNgay sinh as a calendar date YYYY-MM-DD (no time zone).
tierSaleTierRefHang: read-only; null while the Sale has none.
referralCodeStringMa gioi thieu: made by the system when the Sale is created, read-only (NEW-SL-07); null for a Sale that has none.
noteStringGhi chu (at most 500 characters).
profileImageSaleMediaHinh anh ho so (signed URL); null when there is none.
profileFiles[SaleMedia!]!Tep ho so/hop dong/khac, oldest first (signed URLs).
ticketStatusSaleTicketStatusRead-only. Null when there is no ticket; REJECTED after a Tu choi (Q-1).
accountStatusSaleAccountStatus!
openTicketSaleTicketThe open ticket (Cho duyet); null when there is none.
accountStatusEditableBoolean!True when Trang thai tai khoan may be edited: never for Khoi tao (PRD:663).
versionInt!Profile version: the expectedVersion of updateSale (0 = no profile row yet).
createdAtDateTime!
updatedAtDateTime!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ểuMặc địnhMô tả
filterSaleMemberFilter
sortSaleMemberSortUPDATED_DESC
pageInt1
pageSizeInt10

Trả về SaleMemberPage!

FieldKiểuMô tả
items[SaleMember!]!
pageInt!
pageSizeInt!
totalInt!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ểuMặc địnhMô tả
accountIdID!

Trả về SaleMembershipRead

FieldKiểuMô tả
accountIdID!
statusMembershipStatus!
versionInt!APP_SALE membership version: the next expectedVersion of setSaleMembershipStatus.
teamIdIDThe Sale's current team (always set for a row the caller may read).
assignmentVersionIntAssignment 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ểuMặc địnhMô tả
accountIdID!
keywordString
pageInt1
pageSizeInt10

Trả về SaleReferralPage!

FieldKiểuMô tả
items[SaleReferral!]!
pageInt!
pageSizeInt!
totalInt!Rows matching the search.
referredCustomerCountInt!So khach gioi thieu: every customer the Sale referred, ignoring the search.
totalRewardPointsIntTong diem thuong: credited points of the Sale; null only when rewardSourceStatus is not READY.
rewardSourceStatusSaleFieldSourceStatus!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!]!

FieldKiểuMô tả
idID!
codeString!
labelString!
requiresNoteBoolean!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!]!

FieldKiểuMô tả
idID!The tier (createSale.tierId).
codeString!
nameString!

Mutation ​

activateSaleMembership ​

Activate an APPROVED applicant's Sale membership and file its role grant.

mutation · SDL không ghi quyền

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

Trả về SaleActivationResult!

FieldKiểuMô tả
aggregateIdID!The Sale account id.
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextActionAWAIT_APPROVAL with the role change request id.
activationSaleActivation!

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ểuMặc địnhMô tả
inputApproveSaleTicketInput!

Trả về SaleTicketResult!

FieldKiểuMô tả
aggregateIdID!The Sale's account id.
versionInt!The Sale's version after the decision (the next expectedVersion of an edit).
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
memberSaleMemberDetail!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ểuMặc địnhMô tả
inputCreateSaleInput!

Trả về SaleCommandResult!

FieldKiểuMô tả
aggregateIdID!The Sale's account id.
versionInt!The Sale's version after the command (the next expectedVersion).
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when nothing differed (C-03: nothing written, no audit row, version kept).
memberSaleMemberDetail!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ểuMặc địnhMô tả
inputRejectSaleTicketInput!

Trả về SaleTicketResult!

FieldKiểuMô tả
aggregateIdID!The Sale's account id.
versionInt!The Sale's version after the decision (the next expectedVersion of an edit).
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
memberSaleMemberDetail!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ểuMặc địnhMô tả
inputSetSaleAccountStatusInput!

Trả về SaleBulkStatusResult!

FieldKiểuMô tả
aggregateIdID!The smallest account id of the batch (contract-freeze C-05).
versionInt!Version of that Sale after the command.
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when no Sale changed (C-03: nothing written, no audit row).
items[SaleBulkItemResult!]!One row per selected Sale, in account id order.
updatedCountInt!Sales whose status changed (outcome UPDATED).
skippedCountInt!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ểuMặc địnhMô tả
inputSetSaleMembershipStatusInput!

Trả về SaleMembershipStateResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
membershipSaleMembershipState!

transferSaleTeam ​

Move a Sale between two teams the caller manages (effective now).

mutation · SDL không ghi quyền

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

Trả về SaleTeamAssignmentResult!

FieldKiểuMô tả
aggregateIdID!
versionInt!
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextActionNO_CHANGE when the Sale already is in the destination team.
assignmentSaleTeamAssignment!

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ểuMặc địnhMô tả
inputUpdateSaleInput!

Trả về SaleCommandResult!

FieldKiểuMô tả
aggregateIdID!The Sale's account id.
versionInt!The Sale's version after the command (the next expectedVersion).
statusCommandStatus!
requestIdID!
correlationIdID!
nextActionNextAction
changedBoolean!False when nothing differed (C-03: nothing written, no audit row, version kept).
memberSaleMemberDetail!The Sale re-read now (fresh signed URLs, also on a replay).

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17