Skip to content

Chiến dịch ​

Trang sinh tự động

Phần nghiệp vụ viết tay; API, dữ liệu, quyền, đường dẫn và file nguồn do bộ sinh điền từ source tại ad83b0aea.

Làm gì ​

Hai loại chiến dịch: Mua chung và Mua định kỳ. Chiến dịch mở trong một khoảng thời gian, có số lượng tối thiểu và các mốc giảm giá; khi đóng thì chốt bậc giá thực tế rồi tính lại tiền cho mọi đơn.

Quy mô ​

Domain APIcampaign, campaign-import, campaign-public
Query / Mutation28 / 10
Nguồn dữ liệucampaign
Bảng23
Luật phân quyền0
Đường dẫn Web Admin4

Thao tác (mutation) ​

MutationDomainMô tả
adoptRecurringBasketcampaignG2S S3 (BR-MD-05 / BR-MD-11, DR-01, DEC-OWN28-G2S-BASKET-ADOPT-REPLACE): after sign-in, the device basket replaces the caller's DRAFT of the campaign (package, window, lines and per-cycle quantities) or starts one; idempotent by requestId. Requires order.create (U-02, OWN).
clearSearchHistorycampaign-publicDeletes the caller's search history. Signed-in APP_USER buyer only.
createCampaigncampaignTạo chiến dịch (B052.R09): validated, DRAFT -> PENDING_PUBLISH (UPCOMING if publishAt <= now). deal.manage.
deleteCampaigncampaignXóa (B198.R02): hard delete of a DRAFT / PENDING_PUBLISH / UPCOMING without orders. Requires deal.manage.
discardRecurringBasketcampaignDiscards the caller's DRAFT basket. Requires order.create (U-02, OWN).
recordSearchKeywordcampaign-publicPuts the keyword first (duplicates ignoring case and spaces removed), keeps 5; returns the new history. Signed-in APP_USER buyer only.
saveCampaignDraftcampaignLưu nháp (B052.R07): create or edit a Group Buy DRAFT, stored as typed (B006.R16). Requires deal.manage.
saveRecurringBasketDraftcampaignCreates or replaces the caller's DRAFT basket: package (optional since G2S), window, lines and every per-cycle quantity in one write. Requires order.create (U-02, OWN).
saveRecurringCampaignDraftcampaignLưu nháp of a Mua định kỳ DRAFT (create or edit): basket, tiers, windows, packages and schedule in one version. Requires deal.manage.
updateCampaigncampaignLưu thay đổi (B149.R03) in PENDING_PUBLISH / UPCOMING: validated, state kept. Requires deal.manage.

Phép đọc (query) ​

QueryDomainMô tả
campaigncampaignCampaign configuration and history (figures: campaignOverview, U19-P2-08). Requires deal.read.
campaignCloneSourcecampaignNhân bản: the form prefill from a campaign in any state (B006.R13). Requires deal.manage.
campaignCreatorscampaignBộ lọc Người tạo: accounts that may create a campaign (B036.R06). Requires deal.read.
campaignImportCheckcampaign-importKiểm tra file (BR-IM-05): classifies the file against current, writes nothing (DEC-CV3-07). Requires deal.manage.
campaignImportPreflightcampaign-importSố dòng sản phẩm of the chosen file (DEC-CV3-23): the caller's own READY upload, else not_found. Requires deal.manage.
campaignImportTemplatecampaign-importTải file mẫu Mua chung / Mua định kỳ (.xlsx). Requires deal.manage.
campaignOverlapcampaignField check when leaving Thời gian mở/đóng (B006.R18; touching is not overlapping). Requires deal.manage.
campaignOverviewcampaignTổng quan of a Mua chung (B171.R04-R09) or a Mua định kỳ (B256.R02-R10, field recurring). Requires deal.read.
campaignPickerBrandscampaignThương hiệu list of the picker (CV3-P4-16, DEC-CV3-32): live brands whose
campaignPickerCategoriescampaignNgành hàng list of the picker (CV3-P4-16, DEC-CV3-32): every live
campaignProductPickercampaignActive (On sale) single and combo products for a campaign. search under 3
campaignProgresscampaign-publicServer progress/estimate of a published Group Buy (UA-06/07). Requires deal.read_public.
campaignscampaignAdmin list (B011/B031), newest first, filters AND-ed; search = Mã or Tên, ignored under 3 characters;
campaignSettingscampaignSystem parameters of the campaign form. Requires deal.read.
campaignSpinWheelOptionscampaignÁp dụng vòng quay may mắn of the campaign form (CV3-P4-22, DEC-CV3-37,
dealTermsSetscampaignTerms sets by status (default ACTIVE), by name then version. Requires deal.read.
myRecurringBasketcampaignThe caller's own DRAFT basket of a Mua định kỳ campaign, or null. G2S: when the campaign close discarded the draft, the next read returns it once with closedNotice true (status DISCARDED), then null. Requires order.read (U-01, OWN).
mySearchHistorycampaign-publicThe caller's last 5 search keywords, newest first. Signed-in APP_USER buyer only.
publicCampaigncampaign-publicOne published Group Buy (UA-07); unpublished = not_found. Requires deal.read_public.
publicCampaignHomecampaign-publicApp home, Mua chung: one Đang mở + one Sắp mở (null when none). Requires deal.read_public.
publicCampaignscampaign-publicPublished Group Buy campaigns (UA-04..06): only Đang mở (OPEN) and Sắp mở
publicCategoriescampaign-publicLevel-1 categories with at least one Deal shown on the App (Đang mở or Sắp mở). With campaignId (G2S S8, BR-KPD-02): level-1 categories with at least one product in that campaign (Mua định kỳ basket chips; [] when the campaign is not shown on the App). Requires deal.read_public.
publicHomeStatscampaign-publicApp home community figures (system_settings home.* / banner.*). Requires deal.read_public.
publicRecurringCampaigncampaign-publicOne published Recurring basket; unpublished, unknown or Group Buy = not_found. Requires deal.read_public.
publicRecurringCampaignscampaign-publicPublished Recurring baskets (GAP-192): only OPEN and UPCOMING are listed
publicRecurringHomecampaign-publicApp home, Mua định kỳ: one Đang mở + one Sắp mở (null when none). Requires deal.read_public; User App only.
publicSearchcampaign-publicProducts matching the keyword (product name, brand, campaign / basket
publicSearchFacetscampaign-publicCounts for the U-16 filter (same result set as publicSearch). Requires deal.read_public.

Dữ liệu ​

Bảng được tham chiếu nhiều nhất trong module:

BảngCộtĐược trỏ tớiRLS
campaigns3423✓
campaign_policy_versions2213✓
campaign_outcomes176✓
campaign_products206✓
recurring_baskets194✓
recurring_cycles144✓
campaign_delivery_windows93✓
campaign_term_packages113✓
deal_terms_sets92✓
delivery_milestones152✓

Giao diện Web Admin ​

Đường dẫnHằng số
/campaignsCAMPAIGNS
/campaigns/:idCAMPAIGN_DETAIL
/campaigns/:id/editCAMPAIGN_EDIT
/campaigns/newCAMPAIGN_NEW

File nguồn ​

Backend:

  • code/apps/api/supabase/functions/graphql/domains/campaign/
  • code/apps/api/supabase/functions/graphql/domains/campaign-import/
  • code/apps/api/supabase/functions/graphql/domains/campaign-public/

Dữ liệu: bảng thuộc domain campaign — xem Cơ sở dữ liệu.

Tài nguyên quyền không có luật nào

Bản đồ module khai các tài nguyên campaign nhưng ma trận quyền không có luật nào cho chúng. Hoặc tên tài nguyên trong bản đồ sai, hoặc quyền chưa được định nghĩa.

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17