Open source CapCut alternative.
TypeScript
fix(site): move promotions API under su
David Le2d893650a508
diff --git a/site/src/app/api/marketing/promotions/[id]/route.ts b/site/src/app/api/su/promotions/[id]/route.tssimilarity index 100%rename from site/src/app/api/marketing/promotions/[id]/route.tsrename to site/src/app/api/su/promotions/[id]/route.tsdiff --git a/site/src/app/api/marketing/promotions/[id]/send/route.ts b/site/src/app/api/su/promotions/[id]/send/route.tssimilarity index 100%rename from site/src/app/api/marketing/promotions/[id]/send/route.tsrename to site/src/app/api/su/promotions/[id]/send/route.tsdiff --git a/site/src/app/api/marketing/promotions/[id]/test/route.ts b/site/src/app/api/su/promotions/[id]/test/route.tssimilarity index 100%rename from site/src/app/api/marketing/promotions/[id]/test/route.tsrename to site/src/app/api/su/promotions/[id]/test/route.tsdiff --git a/site/src/app/api/marketing/promotions/route.ts b/site/src/app/api/su/promotions/route.tssimilarity index 100%rename from site/src/app/api/marketing/promotions/route.tsrename to site/src/app/api/su/promotions/route.tsdiff --git a/site/src/app/api/marketing/promotions/segment/route.ts b/site/src/app/api/su/promotions/segment/route.tssimilarity index 100%rename from site/src/app/api/marketing/promotions/segment/route.tsrename to site/src/app/api/su/promotions/segment/route.tsdiff --git a/site/src/queries/promotions.ts b/site/src/queries/promotions.tsindex 34584044..dde26327 100644--- a/site/src/queries/promotions.ts+++ b/site/src/queries/promotions.ts@@ -21,7 +21,7 @@ type Body = { promotions: PromotionSummary[]; senders: Record<PromotionSender, s// each sender stands for. Polls while a send is running.export function usePromotions() {return useQuery({- queryFn: () => apiFetch<Body>("/api/marketing/promotions"),+ queryFn: () => apiFetch<Body>("/api/su/promotions"),queryKey: promotionsQueryKey,refetchInterval: (query) =>query.state.data?.promotions.some((p) => p.status === "sending") ? 3000 : false,@@ -34,7 +34,7 @@ export function useSavePromotion() {return useMutation({mutationFn: ({ id, ...input }: PromotionInput & { id: string | null }) =>apiFetch<{ id: string; promotions: PromotionSummary[] }>(- id ? `/api/marketing/promotions/${encodeURIComponent(id)}` : "/api/marketing/promotions",+ id ? `/api/su/promotions/${encodeURIComponent(id)}` : "/api/su/promotions",{ body: JSON.stringify(input), method: id ? "PUT" : "POST" },),onSuccess: () => queryClient.invalidateQueries({ queryKey: promotionsQueryKey }),@@ -45,7 +45,7 @@ export function useDeletePromotion() {const queryClient = useQueryClient();return useMutation({mutationFn: (id: string) =>- apiFetch<{ promotions: PromotionSummary[] }>(`/api/marketing/promotions/${encodeURIComponent(id)}`, {+ apiFetch<{ promotions: PromotionSummary[] }>(`/api/su/promotions/${encodeURIComponent(id)}`, {method: "DELETE",}),onSuccess: () => queryClient.invalidateQueries({ queryKey: promotionsQueryKey }),@@ -58,7 +58,7 @@ export function useSendPromotion() {return useMutation({mutationFn: (id: string) =>apiFetch<{ jobId: string; recipients: number }>(- `/api/marketing/promotions/${encodeURIComponent(id)}/send`,+ `/api/su/promotions/${encodeURIComponent(id)}/send`,{ method: "POST" },),onSuccess: () => queryClient.invalidateQueries({ queryKey: promotionsQueryKey }),@@ -69,7 +69,7 @@ export function useSendPromotion() {export function useTestPromotion() {return useMutation({mutationFn: (id: string) =>- apiFetch<{ sentTo: string }>(`/api/marketing/promotions/${encodeURIComponent(id)}/test`, {+ apiFetch<{ sentTo: string }>(`/api/su/promotions/${encodeURIComponent(id)}/test`, {method: "POST",}),});@@ -79,7 +79,7 @@ export function useTestPromotion() {export function useCountSegment() {return useMutation({mutationFn: (segment: { audience: Audience; excludePromotionIds: string[] }) =>- apiFetch<SegmentCount>("/api/marketing/promotions/segment", {+ apiFetch<SegmentCount>("/api/su/promotions/segment", {body: JSON.stringify(segment),method: "POST",}),