feat: 实现小程序代码发布任务闭环
This commit is contained in:
1 parent
9b35b8e7a7
commit
526a9db789
14 files changed
+7022
-29
No files matched your search
@@ -17,3 +17,5 @@ OBJECT_STORAGE_ACCESS_KEY=minioadmin
|
|||||||
OBJECT_STORAGE_SECRET_KEY=minioadmin
|
OBJECT_STORAGE_SECRET_KEY=minioadmin
|
||||||
WECHAT_APP_ID=
|
WECHAT_APP_ID=
|
||||||
WECHAT_APP_SECRET=
|
WECHAT_APP_SECRET=
|
||||||
|
WECHAT_UPLOAD_PRIVATE_KEY=
|
||||||
|
WEAPP_ARTIFACT_PATH=apps/taro/dist/food/weapp
|
||||||
@@ -4,6 +4,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
Button,
|
Button,
|
||||||
|
Card,
|
||||||
Divider,
|
Divider,
|
||||||
Empty,
|
Empty,
|
||||||
Input,
|
Input,
|
||||||
@@ -64,6 +65,10 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
queryKey: ["publication-releases"],
|
queryKey: ["publication-releases"],
|
||||||
queryFn: () => client.listAdminReleases(),
|
queryFn: () => client.listAdminReleases(),
|
||||||
});
|
});
|
||||||
|
const miniAppReleases = useQuery({
|
||||||
|
queryKey: ["publication-miniapp-releases"],
|
||||||
|
queryFn: () => client.listAdminMiniAppReleases(),
|
||||||
|
});
|
||||||
const refresh = () => {
|
const refresh = () => {
|
||||||
for (const key of [
|
for (const key of [
|
||||||
"publication-brand",
|
"publication-brand",
|
||||||
@@ -71,6 +76,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
"publication-sample",
|
"publication-sample",
|
||||||
"publication-readiness",
|
"publication-readiness",
|
||||||
"publication-releases",
|
"publication-releases",
|
||||||
|
"publication-miniapp-releases",
|
||||||
"admin-shell-brand",
|
"admin-shell-brand",
|
||||||
"admin-workspace",
|
"admin-workspace",
|
||||||
"public-runtime-workspace",
|
"public-runtime-workspace",
|
||||||
@@ -132,8 +138,37 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const loading = [brand, workspace, catalog, readiness, releases].some((query) => query.isLoading);
|
const createMiniAppRelease = useMutation({
|
||||||
const error = [brand, workspace, catalog, readiness, releases].find(
|
mutationFn: () => client.createAdminMiniAppRelease(),
|
||||||
|
onSuccess: () => {
|
||||||
|
message.success("小程序发布任务已创建");
|
||||||
|
void miniAppReleases.refetch();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const uploadMiniAppRelease = useMutation({
|
||||||
|
mutationFn: (id: string) => client.uploadAdminMiniAppRelease(id),
|
||||||
|
onSuccess: () => {
|
||||||
|
message.success("小程序代码已上传");
|
||||||
|
void miniAppReleases.refetch();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const updateMiniAppStatus = useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
id,
|
||||||
|
status,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
status: Parameters<typeof client.updateAdminMiniAppReleaseStatus>[1]["status"];
|
||||||
|
}) => client.updateAdminMiniAppReleaseStatus(id, { status }),
|
||||||
|
onSuccess: () => {
|
||||||
|
message.success("小程序发布状态已更新");
|
||||||
|
void miniAppReleases.refetch();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const loading = [brand, workspace, catalog, readiness, releases, miniAppReleases].some(
|
||||||
|
(query) => query.isLoading,
|
||||||
|
);
|
||||||
|
const error = [brand, workspace, catalog, readiness, releases, miniAppReleases].find(
|
||||||
(query) => query.isError,
|
(query) => query.isError,
|
||||||
)?.error;
|
)?.error;
|
||||||
const retry = () => {
|
const retry = () => {
|
||||||
@@ -142,6 +177,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
void catalog.refetch();
|
void catalog.refetch();
|
||||||
void readiness.refetch();
|
void readiness.refetch();
|
||||||
void releases.refetch();
|
void releases.refetch();
|
||||||
|
void miniAppReleases.refetch();
|
||||||
};
|
};
|
||||||
const industryKey =
|
const industryKey =
|
||||||
workspace.data?.installations[0]?.templateKey ??
|
workspace.data?.installations[0]?.templateKey ??
|
||||||
@@ -343,6 +379,109 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
)}
|
)}
|
||||||
<MutationError error={rollback.error} />
|
<MutationError error={rollback.error} />
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<Typography.Title level={4}>小程序代码发布</Typography.Title>
|
||||||
|
<Typography.Paragraph type="secondary">
|
||||||
|
使用微信官方 miniprogram-ci 上传代码;审核与发布状态需按微信平台结果人工确认。
|
||||||
|
</Typography.Paragraph>
|
||||||
|
<Button
|
||||||
|
disabled={!currentRelease}
|
||||||
|
loading={createMiniAppRelease.isPending}
|
||||||
|
onClick={() => createMiniAppRelease.mutate()}
|
||||||
|
>
|
||||||
|
基于当前品牌版本创建任务
|
||||||
|
</Button>
|
||||||
|
<Divider />
|
||||||
|
{miniAppReleases.data?.length ? (
|
||||||
|
<Space direction="vertical" style={{ width: "100%" }}>
|
||||||
|
{miniAppReleases.data.map((task) => (
|
||||||
|
<Card key={task.id} size="small">
|
||||||
|
<Space wrap>
|
||||||
|
<Typography.Text>品牌 v{task.version}</Typography.Text>
|
||||||
|
<Tag
|
||||||
|
color={
|
||||||
|
task.status === "published"
|
||||||
|
? "green"
|
||||||
|
: task.status === "failed"
|
||||||
|
? "red"
|
||||||
|
: "blue"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{task.status}
|
||||||
|
</Tag>
|
||||||
|
{task.weappUploadId && (
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
微信版本 {task.weappUploadId}
|
||||||
|
</Typography.Text>
|
||||||
|
)}
|
||||||
|
{task.error && <Typography.Text type="danger">{task.error}</Typography.Text>}
|
||||||
|
{task.status === "built" && (
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
loading={uploadMiniAppRelease.isPending}
|
||||||
|
onClick={() => uploadMiniAppRelease.mutate(task.id)}
|
||||||
|
>
|
||||||
|
上传微信
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{task.status === "uploaded" && (
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
onClick={() =>
|
||||||
|
updateMiniAppStatus.mutate({ id: task.id, status: "under_review" })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
标记提交审核
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{task.status === "under_review" && (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
onClick={() =>
|
||||||
|
updateMiniAppStatus.mutate({ id: task.id, status: "approved" })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
审核通过
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
danger
|
||||||
|
onClick={() =>
|
||||||
|
updateMiniAppStatus.mutate({ id: task.id, status: "rejected" })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
审核驳回
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{task.status === "approved" && (
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
onClick={() =>
|
||||||
|
updateMiniAppStatus.mutate({ id: task.id, status: "published" })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
标记已发布
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{task.status === "failed" && (
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
onClick={() => updateMiniAppStatus.mutate({ id: task.id, status: "built" })}
|
||||||
|
>
|
||||||
|
重置可上传
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
) : (
|
||||||
|
<Empty description="暂无小程序发布任务" />
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
</Space>
|
</Space>
|
||||||
<Modal
|
<Modal
|
||||||
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.1",
|
"class-validator": "^0.14.1",
|
||||||
"fastify": "^5.11.3",
|
"fastify": "^5.11.3",
|
||||||
|
"miniprogram-ci": "^2.1.31",
|
||||||
"prisma": "^6.2.1",
|
"prisma": "^6.2.1",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
"rxjs": "^7.8.1"
|
"rxjs": "^7.8.1"
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
CREATE TYPE "MiniAppReleaseStatus" AS ENUM ('built', 'uploaded', 'under_review', 'rejected', 'approved', 'published', 'failed');
|
||||||
|
CREATE TABLE "MiniAppReleaseTask" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"brandId" TEXT NOT NULL,
|
||||||
|
"releaseId" TEXT,
|
||||||
|
"version" INTEGER NOT NULL,
|
||||||
|
"status" "MiniAppReleaseStatus" NOT NULL DEFAULT 'built',
|
||||||
|
"artifactPath" TEXT,
|
||||||
|
"actorId" TEXT NOT NULL,
|
||||||
|
"error" TEXT,
|
||||||
|
"weappUploadId" TEXT,
|
||||||
|
"audit" JSONB,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "MiniAppReleaseTask_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
CREATE INDEX "MiniAppReleaseTask_brandId_createdAt_idx" ON "MiniAppReleaseTask"("brandId", "createdAt" DESC);
|
||||||
|
CREATE UNIQUE INDEX "MiniAppReleaseTask_brandId_version_key" ON "MiniAppReleaseTask"("brandId", "version");
|
||||||
|
ALTER TABLE "MiniAppReleaseTask" ADD CONSTRAINT "MiniAppReleaseTask_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "BrandProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
ALTER TABLE "MiniAppReleaseTask" ADD CONSTRAINT "MiniAppReleaseTask_releaseId_fkey" FOREIGN KEY ("releaseId") REFERENCES "BrandRelease"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
@@ -63,6 +63,7 @@ model BrandProfile {
|
|||||||
capabilityAuditLogs CapabilityAuditLog[]
|
capabilityAuditLogs CapabilityAuditLog[]
|
||||||
adminMemberships BrandMembership[]
|
adminMemberships BrandMembership[]
|
||||||
releases BrandRelease[]
|
releases BrandRelease[]
|
||||||
|
miniAppReleases MiniAppReleaseTask[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model BrandRelease {
|
model BrandRelease {
|
||||||
@@ -77,6 +78,8 @@ model BrandRelease {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
revokedAt DateTime?
|
revokedAt DateTime?
|
||||||
revokedBy String?
|
revokedBy String?
|
||||||
|
miniAppReleases MiniAppReleaseTask[]
|
||||||
|
|
||||||
@@unique([brandId, version])
|
@@unique([brandId, version])
|
||||||
@@index([brandId, status, createdAt])
|
@@index([brandId, status, createdAt])
|
||||||
}
|
}
|
||||||
@@ -91,10 +94,41 @@ model CapabilityInstallation {
|
|||||||
config Json?
|
config Json?
|
||||||
installedAt DateTime @default(now())
|
installedAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
@@unique([brandId, capabilityKey])
|
@@unique([brandId, capabilityKey])
|
||||||
@@index([brandId, status])
|
@@index([brandId, status])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum MiniAppReleaseStatus {
|
||||||
|
built
|
||||||
|
uploaded
|
||||||
|
under_review
|
||||||
|
rejected
|
||||||
|
approved
|
||||||
|
published
|
||||||
|
failed
|
||||||
|
}
|
||||||
|
|
||||||
|
model MiniAppReleaseTask {
|
||||||
|
id String @id @default(uuid())
|
||||||
|
brandId String
|
||||||
|
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||||
|
releaseId String?
|
||||||
|
release BrandRelease? @relation(fields: [releaseId], references: [id], onDelete: SetNull)
|
||||||
|
version Int
|
||||||
|
status MiniAppReleaseStatus @default(built)
|
||||||
|
artifactPath String?
|
||||||
|
actorId String
|
||||||
|
error String?
|
||||||
|
weappUploadId String?
|
||||||
|
audit Json?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@unique([brandId, version])
|
||||||
|
@@index([brandId, createdAt])
|
||||||
|
}
|
||||||
|
|
||||||
model CapabilityAuditLog {
|
model CapabilityAuditLog {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
brandId String
|
brandId String
|
||||||
@@ -106,6 +140,7 @@ model CapabilityAuditLog {
|
|||||||
toStatus String
|
toStatus String
|
||||||
config Json?
|
config Json?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
@@index([brandId, capabilityKey, createdAt])
|
@@index([brandId, capabilityKey, createdAt])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +154,7 @@ model BrandTemplateInstallation {
|
|||||||
previousSnapshots Json @default("[]")
|
previousSnapshots Json @default("[]")
|
||||||
installedAt DateTime @default(now())
|
installedAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
@@unique([brandId, templateKey])
|
@@unique([brandId, templateKey])
|
||||||
@@index([brandId])
|
@@index([brandId])
|
||||||
}
|
}
|
||||||
@@ -140,6 +176,7 @@ model BrandFieldDefinition {
|
|||||||
visibleWhen Json?
|
visibleWhen Json?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
@@unique([brandId, scope, key])
|
@@unique([brandId, scope, key])
|
||||||
@@index([brandId, scope, sortOrder])
|
@@index([brandId, scope, sortOrder])
|
||||||
}
|
}
|
||||||
@@ -164,6 +201,7 @@ model Offering {
|
|||||||
inquirySubmissions InquirySubmission[]
|
inquirySubmissions InquirySubmission[]
|
||||||
bookings Booking[]
|
bookings Booking[]
|
||||||
bookingItems BookingItem[]
|
bookingItems BookingItem[]
|
||||||
|
|
||||||
@@unique([brandId, name])
|
@@unique([brandId, name])
|
||||||
@@index([brandId, isEnabled, sortOrder])
|
@@index([brandId, isEnabled, sortOrder])
|
||||||
}
|
}
|
||||||
@@ -184,6 +222,7 @@ model InquiryForm {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
submissions InquirySubmission[]
|
submissions InquirySubmission[]
|
||||||
|
|
||||||
@@index([brandId, isEnabled])
|
@@index([brandId, isEnabled])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +244,7 @@ model InquirySubmission {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
statusHistory InquirySubmissionStatusHistory[]
|
statusHistory InquirySubmissionStatusHistory[]
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
@@index([brandId, createdAt])
|
@@index([brandId, createdAt])
|
||||||
@@index([brandId, customerSubject, createdAt])
|
@@index([brandId, customerSubject, createdAt])
|
||||||
@@index([inquiryFormId, formVersion])
|
@@index([inquiryFormId, formVersion])
|
||||||
@@ -218,6 +258,7 @@ model InquirySubmissionStatusHistory {
|
|||||||
toStatus String
|
toStatus String
|
||||||
adminNote String?
|
adminNote String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
@@index([submissionId, createdAt])
|
@@index([submissionId, createdAt])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,6 +276,7 @@ model TrustContent {
|
|||||||
config Json?
|
config Json?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
@@index([brandId, type, sortOrder])
|
@@index([brandId, type, sortOrder])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +289,7 @@ model CustomerUser {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
bookings Booking[]
|
bookings Booking[]
|
||||||
|
|
||||||
@@unique([brandId, openid])
|
@@unique([brandId, openid])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,6 +325,7 @@ model Booking {
|
|||||||
items BookingItem[]
|
items BookingItem[]
|
||||||
tags BookingTag[]
|
tags BookingTag[]
|
||||||
stateTransitions BookingStateTransition[]
|
stateTransitions BookingStateTransition[]
|
||||||
|
|
||||||
@@index([brandId, status, createdAt])
|
@@index([brandId, status, createdAt])
|
||||||
@@index([customerUserId, createdAt])
|
@@index([customerUserId, createdAt])
|
||||||
}
|
}
|
||||||
@@ -296,6 +340,7 @@ model BookingStateTransition {
|
|||||||
toState String
|
toState String
|
||||||
actorRole String
|
actorRole String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
@@index([bookingId, createdAt])
|
@@index([bookingId, createdAt])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,6 +365,7 @@ model Tag {
|
|||||||
isEnabled Boolean @default(true)
|
isEnabled Boolean @default(true)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
bookings BookingTag[]
|
bookings BookingTag[]
|
||||||
|
|
||||||
@@unique([brandId, name])
|
@@unique([brandId, name])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,6 +393,7 @@ model BrandMembership {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
adminUser AdminUser @relation(fields: [adminUserId], references: [id], onDelete: Cascade)
|
adminUser AdminUser @relation(fields: [adminUserId], references: [id], onDelete: Cascade)
|
||||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@unique([adminUserId, brandId])
|
@@unique([adminUserId, brandId])
|
||||||
@@index([brandId, isEnabled])
|
@@index([brandId, isEnabled])
|
||||||
}
|
}
|
||||||
@@ -356,5 +403,6 @@ model BookingTag {
|
|||||||
tagId String
|
tagId String
|
||||||
booking Booking @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
booking Booking @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
||||||
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@id([bookingId, tagId])
|
@@id([bookingId, tagId])
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,8 @@ import { AdminMembershipGuard } from "./admin-membership.guard.js";
|
|||||||
import { BrandReleaseService } from "./brand-release.service.js";
|
import { BrandReleaseService } from "./brand-release.service.js";
|
||||||
import { BrandReleaseApiService } from "./brand-release-api.service.js";
|
import { BrandReleaseApiService } from "./brand-release-api.service.js";
|
||||||
import { AdminReleaseController } from "./modules/admin/admin-release.controller.js";
|
import { AdminReleaseController } from "./modules/admin/admin-release.controller.js";
|
||||||
|
import { AdminMiniAppReleaseController } from "./modules/admin/admin-miniapp-release.controller.js";
|
||||||
|
import { AdminMiniAppReleaseService } from "./modules/admin/admin-miniapp-release.service.js";
|
||||||
import {
|
import {
|
||||||
CustomerSessionController,
|
CustomerSessionController,
|
||||||
AdminSessionController,
|
AdminSessionController,
|
||||||
@@ -65,6 +67,7 @@ export class HealthController {
|
|||||||
AdminBookingController,
|
AdminBookingController,
|
||||||
AdminConfigController,
|
AdminConfigController,
|
||||||
AdminReleaseController,
|
AdminReleaseController,
|
||||||
|
AdminMiniAppReleaseController,
|
||||||
AdminUploadController,
|
AdminUploadController,
|
||||||
AdminLocalUploadController,
|
AdminLocalUploadController,
|
||||||
],
|
],
|
||||||
@@ -78,6 +81,7 @@ export class HealthController {
|
|||||||
AdminMembershipGuard,
|
AdminMembershipGuard,
|
||||||
BrandReleaseService,
|
BrandReleaseService,
|
||||||
BrandReleaseApiService,
|
BrandReleaseApiService,
|
||||||
|
AdminMiniAppReleaseService,
|
||||||
PublicBrandContextService,
|
PublicBrandContextService,
|
||||||
PublicWorkspaceService,
|
PublicWorkspaceService,
|
||||||
AdminOfferingService,
|
AdminOfferingService,
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
import {
|
||||||
|
BadRequestException,
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
Patch,
|
||||||
|
Post,
|
||||||
|
Req,
|
||||||
|
} from "@nestjs/common";
|
||||||
|
import type { FastifyRequest } from "fastify";
|
||||||
|
import { existsSync } from "node:fs";
|
||||||
|
import { resolve } from "node:path";
|
||||||
|
import { AdminAccessService } from "../../admin-access.service.js";
|
||||||
|
import { PrismaService } from "../../prisma.service.js";
|
||||||
|
import { AdminMiniAppReleaseService } from "./admin-miniapp-release.service.js";
|
||||||
|
import {
|
||||||
|
CreateMiniAppReleaseDto,
|
||||||
|
UpdateMiniAppReleaseStatusDto,
|
||||||
|
UploadMiniAppReleaseDto,
|
||||||
|
} from "./admin-miniapp-release.dto.js";
|
||||||
|
|
||||||
|
interface MiniprogramCi {
|
||||||
|
Project: new (options: {
|
||||||
|
projectPath: string;
|
||||||
|
type: "miniProgram";
|
||||||
|
appid: string;
|
||||||
|
privateKey: string;
|
||||||
|
}) => unknown;
|
||||||
|
upload: (options: {
|
||||||
|
project: unknown;
|
||||||
|
version: string;
|
||||||
|
desc: string;
|
||||||
|
robot: number;
|
||||||
|
setting: { es6: boolean; minified: boolean };
|
||||||
|
}) => Promise<Record<string, unknown>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Controller("admin/miniapp-releases")
|
||||||
|
export class AdminMiniAppReleaseController {
|
||||||
|
constructor(
|
||||||
|
private readonly access: AdminAccessService,
|
||||||
|
private readonly releases: AdminMiniAppReleaseService,
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
list(@Req() request: FastifyRequest): Promise<unknown[]> {
|
||||||
|
return this.identity(request).then(({ brandId }) => this.releases.list(brandId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
create(@Req() request: FastifyRequest, @Body() body: CreateMiniAppReleaseDto): Promise<unknown> {
|
||||||
|
return this.identity(request).then(({ brandId, subject }) =>
|
||||||
|
this.releases.create(brandId, subject, body),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(":id/upload")
|
||||||
|
async upload(
|
||||||
|
@Req() request: FastifyRequest,
|
||||||
|
@Param("id") taskId: string,
|
||||||
|
@Body() body: UploadMiniAppReleaseDto,
|
||||||
|
): Promise<unknown> {
|
||||||
|
const identity = await this.identity(request);
|
||||||
|
const task = await this.prisma.miniAppReleaseTask.findFirst({
|
||||||
|
where: { id: taskId, brandId: identity.brandId },
|
||||||
|
});
|
||||||
|
if (!task) throw new BadRequestException("小程序发布任务不存在");
|
||||||
|
if (task.status !== "built") throw new BadRequestException("当前小程序发布任务不能重复上传");
|
||||||
|
const appid = this.requiredEnv("WECHAT_APP_ID");
|
||||||
|
const privateKey = this.requiredEnv("WECHAT_UPLOAD_PRIVATE_KEY");
|
||||||
|
const artifactPath = process.env.WEAPP_ARTIFACT_PATH;
|
||||||
|
if (!artifactPath) throw new BadRequestException("WEAPP_ARTIFACT_PATH 未配置");
|
||||||
|
const projectPath = resolve(artifactPath);
|
||||||
|
if (!existsSync(projectPath) || !existsSync(resolve(projectPath, "app.json")))
|
||||||
|
throw new BadRequestException("小程序构建产物不存在");
|
||||||
|
const ci = (await import("miniprogram-ci")) as unknown as MiniprogramCi;
|
||||||
|
const project = new ci.Project({
|
||||||
|
projectPath,
|
||||||
|
type: "miniProgram",
|
||||||
|
appid,
|
||||||
|
privateKey,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const result = await ci.upload({
|
||||||
|
project,
|
||||||
|
version: body.version ?? String(task.version),
|
||||||
|
desc: body.desc ?? `brand content v${task.version}`,
|
||||||
|
robot: body.robot ?? 1,
|
||||||
|
setting: { es6: false, minified: true },
|
||||||
|
});
|
||||||
|
return this.releases.updateStatus(identity.brandId, identity.subject, taskId, {
|
||||||
|
status: "uploaded",
|
||||||
|
weappUploadId:
|
||||||
|
typeof result.strUint64Version === "string"
|
||||||
|
? result.strUint64Version
|
||||||
|
: String(task.version),
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
await this.releases.updateStatus(identity.brandId, identity.subject, taskId, {
|
||||||
|
status: "failed",
|
||||||
|
error: error instanceof Error ? error.message : "微信代码上传失败",
|
||||||
|
});
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Patch(":id/status")
|
||||||
|
async updateStatus(
|
||||||
|
@Req() request: FastifyRequest,
|
||||||
|
@Param("id") taskId: string,
|
||||||
|
@Body() body: UpdateMiniAppReleaseStatusDto,
|
||||||
|
): Promise<unknown> {
|
||||||
|
const identity = await this.identity(request);
|
||||||
|
return this.releases.updateStatus(identity.brandId, identity.subject, taskId, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async identity(request: FastifyRequest): Promise<{ subject: string; brandId: string }> {
|
||||||
|
const { subject, brandId } = await this.access.requireBrand(request);
|
||||||
|
return { subject, brandId };
|
||||||
|
}
|
||||||
|
|
||||||
|
private requiredEnv(name: string): string {
|
||||||
|
const value = process.env[name];
|
||||||
|
if (!value) throw new BadRequestException(`${name} 未配置`);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { Type } from "class-transformer";
|
||||||
|
import { IsIn, IsOptional, IsString, IsUUID, MaxLength } from "class-validator";
|
||||||
|
|
||||||
|
export class CreateMiniAppReleaseDto {
|
||||||
|
@IsOptional()
|
||||||
|
@IsUUID()
|
||||||
|
releaseId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateMiniAppReleaseStatusDto {
|
||||||
|
@IsIn(["uploaded", "under_review", "approved", "rejected", "failed", "built", "published"])
|
||||||
|
status!: "uploaded" | "under_review" | "approved" | "rejected" | "failed" | "built" | "published";
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(2000)
|
||||||
|
error?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(200)
|
||||||
|
weappUploadId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UploadMiniAppReleaseDto {
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(100)
|
||||||
|
version?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(500)
|
||||||
|
desc?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsIn([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||||
|
robot?: number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
import {
|
||||||
|
BadRequestException,
|
||||||
|
ConflictException,
|
||||||
|
Injectable,
|
||||||
|
NotFoundException,
|
||||||
|
} from "@nestjs/common";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { PrismaService } from "../../prisma.service.js";
|
||||||
|
|
||||||
|
const transitions: Record<string, string[]> = {
|
||||||
|
built: ["uploaded", "under_review", "failed"],
|
||||||
|
uploaded: ["under_review", "failed"],
|
||||||
|
under_review: ["approved", "rejected", "failed"],
|
||||||
|
approved: ["published", "failed"],
|
||||||
|
rejected: [],
|
||||||
|
failed: ["built"],
|
||||||
|
published: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AdminMiniAppReleaseService {
|
||||||
|
constructor(private readonly prisma: PrismaService) {}
|
||||||
|
|
||||||
|
async list(brandId: string): Promise<unknown[]> {
|
||||||
|
return this.prisma.miniAppReleaseTask.findMany({
|
||||||
|
where: { brandId },
|
||||||
|
orderBy: { createdAt: "desc" },
|
||||||
|
take: 50,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(brandId: string, actorId: string, input: { releaseId?: string }): Promise<unknown> {
|
||||||
|
return this.prisma.$transaction(
|
||||||
|
async (tx) => {
|
||||||
|
const release = input.releaseId
|
||||||
|
? await tx.brandRelease.findFirst({ where: { id: input.releaseId, brandId } })
|
||||||
|
: await tx.brandRelease.findFirst({
|
||||||
|
where: { brandId, status: "published" },
|
||||||
|
orderBy: { version: "desc" },
|
||||||
|
});
|
||||||
|
if (!release) throw new BadRequestException("请先发布品牌内容版本");
|
||||||
|
const existing = await tx.miniAppReleaseTask.findUnique({
|
||||||
|
where: { brandId_version: { brandId, version: release.version } },
|
||||||
|
});
|
||||||
|
if (existing) return existing;
|
||||||
|
return tx.miniAppReleaseTask.create({
|
||||||
|
data: {
|
||||||
|
brandId,
|
||||||
|
releaseId: release.id,
|
||||||
|
version: release.version,
|
||||||
|
actorId,
|
||||||
|
status: "built",
|
||||||
|
audit: { action: "created", actorId, at: new Date().toISOString() },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{ isolationLevel: Prisma.TransactionIsolationLevel.Serializable },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateStatus(
|
||||||
|
brandId: string,
|
||||||
|
actorId: string,
|
||||||
|
taskId: string,
|
||||||
|
input: {
|
||||||
|
status:
|
||||||
|
"uploaded" | "under_review" | "approved" | "rejected" | "failed" | "built" | "published";
|
||||||
|
error?: string;
|
||||||
|
weappUploadId?: string;
|
||||||
|
},
|
||||||
|
): Promise<unknown> {
|
||||||
|
return this.prisma.$transaction(
|
||||||
|
async (tx) => {
|
||||||
|
const task = await tx.miniAppReleaseTask.findFirst({ where: { id: taskId, brandId } });
|
||||||
|
if (!task) throw new NotFoundException("小程序发布任务不存在");
|
||||||
|
if (!transitions[task.status]?.includes(input.status))
|
||||||
|
throw new ConflictException("小程序发布状态不能按此顺序变更");
|
||||||
|
const audit = this.audit(task.audit, {
|
||||||
|
action: "status-updated",
|
||||||
|
actorId,
|
||||||
|
from: task.status,
|
||||||
|
to: input.status,
|
||||||
|
at: new Date().toISOString(),
|
||||||
|
...(input.error ? { error: input.error } : {}),
|
||||||
|
});
|
||||||
|
const updated = await tx.miniAppReleaseTask.update({
|
||||||
|
where: { id: task.id },
|
||||||
|
data: {
|
||||||
|
status: input.status,
|
||||||
|
error: input.error ?? null,
|
||||||
|
...(input.weappUploadId ? { weappUploadId: input.weappUploadId } : {}),
|
||||||
|
audit,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
...updated,
|
||||||
|
status: input.status,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{ isolationLevel: Prisma.TransactionIsolationLevel.Serializable },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private audit(value: Prisma.JsonValue | null, entry: Record<string, unknown>) {
|
||||||
|
return [...(Array.isArray(value) ? value : []), entry] as Prisma.InputJsonValue[];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,11 +23,79 @@ before(async () => {
|
|||||||
after(async () => {
|
after(async () => {
|
||||||
await app.close();
|
await app.close();
|
||||||
await prisma.brandRelease.deleteMany({ where: { brandId } });
|
await prisma.brandRelease.deleteMany({ where: { brandId } });
|
||||||
|
await prisma.miniAppReleaseTask.deleteMany({ where: { brandId } });
|
||||||
await prisma.booking.deleteMany({ where: { id: { in: createdBookingIds } } });
|
await prisma.booking.deleteMany({ where: { id: { in: createdBookingIds } } });
|
||||||
await prisma.customerUser.deleteMany({ where: { openid } });
|
await prisma.customerUser.deleteMany({ where: { openid } });
|
||||||
await prisma.$disconnect();
|
await prisma.$disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("miniapp release tasks are authorized, idempotent, and state checked", async () => {
|
||||||
|
const missing = await request("/admin/miniapp-releases");
|
||||||
|
assert.equal(missing.statusCode, 401);
|
||||||
|
assert.equal(
|
||||||
|
(
|
||||||
|
await request("/admin/miniapp-releases", {
|
||||||
|
headers: { authorization: `Bearer ${customerToken}` },
|
||||||
|
})
|
||||||
|
).statusCode,
|
||||||
|
403,
|
||||||
|
);
|
||||||
|
const login = await request("/admin/session/login", {
|
||||||
|
method: "POST",
|
||||||
|
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||||
|
});
|
||||||
|
const headers = { authorization: `Bearer ${JSON.parse(login.body).token}` };
|
||||||
|
const current = JSON.parse((await request("/admin/releases", { headers })).body).find(
|
||||||
|
(item) => item.status === "published",
|
||||||
|
);
|
||||||
|
assert.ok(current);
|
||||||
|
const created = await request("/admin/miniapp-releases", {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
|
assert.equal(created.statusCode, 201);
|
||||||
|
assert.equal(JSON.parse(created.body).version, current.version);
|
||||||
|
const repeated = await request("/admin/miniapp-releases", {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
|
assert.equal(JSON.parse(repeated.body).id, JSON.parse(created.body).id);
|
||||||
|
const taskId = JSON.parse(created.body).id;
|
||||||
|
const skipped = await request(`/admin/miniapp-releases/${taskId}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers,
|
||||||
|
payload: { status: "published" },
|
||||||
|
});
|
||||||
|
assert.equal(skipped.statusCode, 409);
|
||||||
|
const uploaded = await request(`/admin/miniapp-releases/${taskId}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers,
|
||||||
|
payload: { status: "uploaded", weappUploadId: "test-upload" },
|
||||||
|
});
|
||||||
|
assert.equal(uploaded.statusCode, 200);
|
||||||
|
assert.equal(JSON.parse(uploaded.body).status, "uploaded");
|
||||||
|
const underReview = await request(`/admin/miniapp-releases/${taskId}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers,
|
||||||
|
payload: { status: "under_review" },
|
||||||
|
});
|
||||||
|
assert.equal(JSON.parse(underReview.body).status, "under_review");
|
||||||
|
const approved = await request(`/admin/miniapp-releases/${taskId}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers,
|
||||||
|
payload: { status: "approved" },
|
||||||
|
});
|
||||||
|
assert.equal(JSON.parse(approved.body).status, "approved");
|
||||||
|
const published = await request(`/admin/miniapp-releases/${taskId}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers,
|
||||||
|
payload: { status: "published" },
|
||||||
|
});
|
||||||
|
assert.equal(JSON.parse(published.body).status, "published");
|
||||||
|
});
|
||||||
|
|
||||||
test("real template declarations persist brand offering and trust bindings through draft and publication", async (context) => {
|
test("real template declarations persist brand offering and trust bindings through draft and publication", async (context) => {
|
||||||
const user = await prisma.adminUser.findUniqueOrThrow({ where: { username: "admin" } });
|
const user = await prisma.adminUser.findUniqueOrThrow({ where: { username: "admin" } });
|
||||||
const { runtimeContractForBinding } = await import("@personal-brand/types");
|
const { runtimeContractForBinding } = await import("@personal-brand/types");
|
||||||
|
|||||||
@@ -208,6 +208,18 @@ export class ApiClient
|
|||||||
this.resources.brand.rollbackAdminRelease(...arguments_);
|
this.resources.brand.rollbackAdminRelease(...arguments_);
|
||||||
revokeAdminRelease = (...arguments_: Parameters<BrandMethods["revokeAdminRelease"]>) =>
|
revokeAdminRelease = (...arguments_: Parameters<BrandMethods["revokeAdminRelease"]>) =>
|
||||||
this.resources.brand.revokeAdminRelease(...arguments_);
|
this.resources.brand.revokeAdminRelease(...arguments_);
|
||||||
|
listAdminMiniAppReleases = (
|
||||||
|
...arguments_: Parameters<BrandMethods["listAdminMiniAppReleases"]>
|
||||||
|
) => this.resources.brand.listAdminMiniAppReleases(...arguments_);
|
||||||
|
createAdminMiniAppRelease = (
|
||||||
|
...arguments_: Parameters<BrandMethods["createAdminMiniAppRelease"]>
|
||||||
|
) => this.resources.brand.createAdminMiniAppRelease(...arguments_);
|
||||||
|
uploadAdminMiniAppRelease = (
|
||||||
|
...arguments_: Parameters<BrandMethods["uploadAdminMiniAppRelease"]>
|
||||||
|
) => this.resources.brand.uploadAdminMiniAppRelease(...arguments_);
|
||||||
|
updateAdminMiniAppReleaseStatus = (
|
||||||
|
...arguments_: Parameters<BrandMethods["updateAdminMiniAppReleaseStatus"]>
|
||||||
|
) => this.resources.brand.updateAdminMiniAppReleaseStatus(...arguments_);
|
||||||
getPublicTemplate = (...arguments_: Parameters<TemplateMethods["getPublicTemplate"]>) =>
|
getPublicTemplate = (...arguments_: Parameters<TemplateMethods["getPublicTemplate"]>) =>
|
||||||
this.resources.template.getPublicTemplate(...arguments_);
|
this.resources.template.getPublicTemplate(...arguments_);
|
||||||
listPublicTemplates = (...arguments_: Parameters<TemplateMethods["listPublicTemplates"]>) =>
|
listPublicTemplates = (...arguments_: Parameters<TemplateMethods["listPublicTemplates"]>) =>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import type {
|
|||||||
BrandPresentationUpdate,
|
BrandPresentationUpdate,
|
||||||
BrandProfile,
|
BrandProfile,
|
||||||
BrandReleaseSummary,
|
BrandReleaseSummary,
|
||||||
|
MiniAppReleaseTask,
|
||||||
BrandUpdate,
|
BrandUpdate,
|
||||||
} from "../types/brand.js";
|
} from "../types/brand.js";
|
||||||
|
|
||||||
@@ -59,6 +60,20 @@ export interface BrandMethods {
|
|||||||
revokeAdminRelease(): Promise<
|
revokeAdminRelease(): Promise<
|
||||||
Pick<BrandReleaseSummary, "id" | "version" | "status" | "revokedAt">
|
Pick<BrandReleaseSummary, "id" | "version" | "status" | "revokedAt">
|
||||||
>;
|
>;
|
||||||
|
listAdminMiniAppReleases(): Promise<MiniAppReleaseTask[]>;
|
||||||
|
createAdminMiniAppRelease(releaseId?: string): Promise<MiniAppReleaseTask>;
|
||||||
|
uploadAdminMiniAppRelease(
|
||||||
|
id: string,
|
||||||
|
body?: { version?: string; desc?: string; robot?: number },
|
||||||
|
): Promise<MiniAppReleaseTask>;
|
||||||
|
updateAdminMiniAppReleaseStatus(
|
||||||
|
id: string,
|
||||||
|
body: {
|
||||||
|
status: MiniAppReleaseTask["status"];
|
||||||
|
error?: string;
|
||||||
|
weappUploadId?: string;
|
||||||
|
},
|
||||||
|
): Promise<MiniAppReleaseTask>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function brandMethods({ request }: { request: RequestFn }): BrandMethods {
|
export function brandMethods({ request }: { request: RequestFn }): BrandMethods {
|
||||||
@@ -94,5 +109,21 @@ export function brandMethods({ request }: { request: RequestFn }): BrandMethods
|
|||||||
body: note === undefined ? {} : { note },
|
body: note === undefined ? {} : { note },
|
||||||
}),
|
}),
|
||||||
revokeAdminRelease: () => request("/admin/releases/revoke", { method: "POST" }),
|
revokeAdminRelease: () => request("/admin/releases/revoke", { method: "POST" }),
|
||||||
|
listAdminMiniAppReleases: () => request("/admin/miniapp-releases"),
|
||||||
|
createAdminMiniAppRelease: (releaseId) =>
|
||||||
|
request("/admin/miniapp-releases", {
|
||||||
|
method: "POST",
|
||||||
|
...(releaseId ? { body: { releaseId } } : { body: {} }),
|
||||||
|
}),
|
||||||
|
uploadAdminMiniAppRelease: (id, body) =>
|
||||||
|
request(`/admin/miniapp-releases/${encodeURIComponent(id)}/upload`, {
|
||||||
|
method: "POST",
|
||||||
|
body: body ?? {},
|
||||||
|
}),
|
||||||
|
updateAdminMiniAppReleaseStatus: (id, body) =>
|
||||||
|
request(`/admin/miniapp-releases/${encodeURIComponent(id)}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
body,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,17 @@ export interface BrandReleaseSummary {
|
|||||||
revokedBy?: string | null;
|
revokedBy?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MiniAppReleaseTask {
|
||||||
|
id: string;
|
||||||
|
version: number;
|
||||||
|
status: "built" | "uploaded" | "under_review" | "rejected" | "approved" | "published" | "failed";
|
||||||
|
artifactPath?: string | null;
|
||||||
|
error?: string | null;
|
||||||
|
weappUploadId?: string | null;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type BrandPresentationUpdate = Partial<
|
export type BrandPresentationUpdate = Partial<
|
||||||
Record<
|
Record<
|
||||||
"identity" | "home" | "offerings" | "detail" | "profile" | "inquiry" | "success" | "records",
|
"identity" | "home" | "offerings" | "detail" | "profile" | "inquiry" | "success" | "records",
|
||||||
|
|||||||
Generated
+6407
-27
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user