feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -2,6 +2,8 @@ import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { BadRequestException, NotFoundException } from "@nestjs/common";
|
||||
import { BookingService } from "../src/booking.service.js";
|
||||
import type { PrismaService } from "../src/prisma.service.js";
|
||||
import type { BrandReleaseService } from "../src/brand-release.service.js";
|
||||
|
||||
const brandId = "brand-1";
|
||||
const customerId = "customer-1";
|
||||
@@ -11,20 +13,20 @@ const offering = {
|
||||
priceAmount: 2800,
|
||||
};
|
||||
|
||||
function createPrisma(overrides: Record<string, unknown> = {}): any {
|
||||
function createPrisma(overrides: Record<string, unknown> = {}): PrismaService {
|
||||
return {
|
||||
offering: {
|
||||
findMany: async () => [offering],
|
||||
count: async () => 1,
|
||||
},
|
||||
booking: {
|
||||
create: async ({ data }: any) => ({
|
||||
create: async ({ data }: { data: { estimatedAmount: number | null } }) => ({
|
||||
bookingNo: "AC-test",
|
||||
status: "received",
|
||||
estimatedAmount: data.estimatedAmount,
|
||||
createdAt: new Date(),
|
||||
}),
|
||||
findFirst: async () => null,
|
||||
update: async ({ data }: any) => ({ status: data.status }),
|
||||
update: async ({ data }: { data: { status: string } }) => ({ status: data.status }),
|
||||
findMany: async () => [],
|
||||
count: async () => 0,
|
||||
},
|
||||
@@ -32,12 +34,20 @@ function createPrisma(overrides: Record<string, unknown> = {}): any {
|
||||
bookingTag: { deleteMany: {}, createMany: {} },
|
||||
$transaction: async (callback: (tx: unknown) => unknown) => callback(undefined),
|
||||
...overrides,
|
||||
};
|
||||
} as unknown as PrismaService;
|
||||
}
|
||||
|
||||
function createService(prisma = createPrisma()): BookingService {
|
||||
const releases = {
|
||||
getPublishedSnapshot: async () => ({ offerings: [{ ...offering, isEnabled: true }] }),
|
||||
publishedOfferingIds: () => new Set([offering.id]),
|
||||
} as unknown as BrandReleaseService;
|
||||
return new BookingService(prisma, releases);
|
||||
}
|
||||
|
||||
test("创建普通套餐订单时保存价格快照和预计金额", async () => {
|
||||
const prisma = createPrisma();
|
||||
const result = await new BookingService(prisma).create(brandId, customerId, {
|
||||
const result = await createService(prisma).create(brandId, customerId, {
|
||||
requestType: "package",
|
||||
customerName: "陈同学",
|
||||
wechatId: "wx-test",
|
||||
@@ -51,7 +61,7 @@ test("创建普通套餐订单时保存价格快照和预计金额", async () =>
|
||||
test("普通套餐不能在没有明细时创建", async () => {
|
||||
await assert.rejects(
|
||||
() =>
|
||||
new BookingService(createPrisma()).create(brandId, customerId, {
|
||||
createService().create(brandId, customerId, {
|
||||
requestType: "package",
|
||||
customerName: "陈同学",
|
||||
phone: "13800000000",
|
||||
@@ -69,14 +79,14 @@ test("客户只能取消自己的 received 订单", async () => {
|
||||
},
|
||||
});
|
||||
await assert.rejects(
|
||||
() => new BookingService(prisma).cancelForCustomer(brandId, customerId, "booking-1"),
|
||||
() => createService(prisma).cancelForCustomer(brandId, customerId, "booking-1"),
|
||||
(error: unknown) => error instanceof BadRequestException,
|
||||
);
|
||||
});
|
||||
|
||||
test("取消不存在或不属于当前客户的订单返回不存在", async () => {
|
||||
await assert.rejects(
|
||||
() => new BookingService(createPrisma()).cancelForCustomer(brandId, customerId, "missing"),
|
||||
() => createService().cancelForCustomer(brandId, customerId, "missing"),
|
||||
(error: unknown) => error instanceof NotFoundException,
|
||||
);
|
||||
});
|
||||
@@ -91,15 +101,15 @@ test("订单状态只能按定义的状态机流转", async () => {
|
||||
workflowKey: "booking.basic",
|
||||
workflowVersion: "1.0.0",
|
||||
}),
|
||||
update: async ({ data }: any) => data,
|
||||
update: async ({ data }: { data: { status: string } }) => data,
|
||||
},
|
||||
$transaction: async (callback: (tx: any) => unknown) =>
|
||||
$transaction: async (callback: (tx: unknown) => unknown) =>
|
||||
callback({
|
||||
booking: { update: async ({ data }: any) => data },
|
||||
booking: { update: async ({ data }: { data: { status: string } }) => data },
|
||||
bookingStateTransition: { create: async () => undefined },
|
||||
}),
|
||||
});
|
||||
const bookings = new BookingService(prisma);
|
||||
const bookings = createService(prisma);
|
||||
assert.equal(
|
||||
(await bookings.updateStatus(brandId, "booking-1", "contacting")).status,
|
||||
"contacting",
|
||||
@@ -116,7 +126,7 @@ test("更新订单标签时拒绝其他品牌的标签", async () => {
|
||||
tag: { findMany: async () => [] },
|
||||
});
|
||||
await assert.rejects(
|
||||
() => new BookingService(prisma).updateTags(brandId, "booking-1", ["foreign-tag"]),
|
||||
() => createService(prisma).updateTags(brandId, "booking-1", ["foreign-tag"]),
|
||||
(error: unknown) => error instanceof BadRequestException,
|
||||
);
|
||||
});
|
||||
@@ -2,7 +2,8 @@ import assert from "node:assert/strict";
|
||||
import { after, before, test } from "node:test";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { createApp } from "../dist/main.js";
|
||||
import { signIdentity } from "../dist/auth.js";
|
||||
import { readIdentity, signIdentity } from "../dist/auth.js";
|
||||
import { WechatAuthService } from "../dist/wechat-auth.js";
|
||||
|
||||
let app;
|
||||
const prisma = new PrismaClient();
|
||||
@@ -20,11 +21,183 @@ before(async () => {
|
||||
|
||||
after(async () => {
|
||||
await app.close();
|
||||
await prisma.brandRelease.deleteMany({ where: { brandId } });
|
||||
await prisma.booking.deleteMany({ where: { id: { in: createdBookingIds } } });
|
||||
await prisma.customerUser.deleteMany({ where: { openid } });
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
|
||||
test("admin release lifecycle is authorized, brand-scoped, and versioned", async () => {
|
||||
const missing = await request("/admin/releases");
|
||||
assert.equal(missing.statusCode, 401);
|
||||
assert.equal((await request("/admin/releases/readiness")).statusCode, 401);
|
||||
|
||||
const customer = await request("/admin/releases", {
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
});
|
||||
assert.equal(customer.statusCode, 403);
|
||||
assert.equal(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
})
|
||||
).statusCode,
|
||||
403,
|
||||
);
|
||||
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
assert.equal(login.statusCode, 201);
|
||||
const adminToken = JSON.parse(login.body).token;
|
||||
const readiness = await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
assert.equal(readiness.statusCode, 200);
|
||||
assert.equal(JSON.parse(readiness.body).ready, true);
|
||||
const enabledForms = await prisma.inquiryForm.findMany({
|
||||
where: { brandId, isEnabled: true },
|
||||
select: { id: true },
|
||||
});
|
||||
await prisma.inquiryForm.updateMany({ where: { brandId }, data: { isEnabled: false } });
|
||||
try {
|
||||
const noForms = await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
assert.equal(JSON.parse(noForms.body).ready, false);
|
||||
assert.equal(
|
||||
JSON.parse(noForms.body).checks.find((check) => check.key === "forms")?.passed,
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
await prisma.inquiryForm.updateMany({
|
||||
where: { id: { in: enabledForms.map((form) => form.id) } },
|
||||
data: { isEnabled: true },
|
||||
});
|
||||
}
|
||||
const originalBrand = await prisma.brandProfile.findUniqueOrThrow({ where: { id: brandId } });
|
||||
await prisma.brandProfile.update({ where: { id: brandId }, data: { tagline: "" } });
|
||||
const incomplete = await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
assert.equal(JSON.parse(incomplete.body).ready, false);
|
||||
assert.equal(
|
||||
(
|
||||
await request("/admin/releases/publish", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
payload: {},
|
||||
})
|
||||
).statusCode,
|
||||
400,
|
||||
);
|
||||
await prisma.brandProfile.update({
|
||||
where: { id: brandId },
|
||||
data: { tagline: "集成测试待发布标语" },
|
||||
});
|
||||
const beforePublish = JSON.parse((await request("/public/workspace")).body);
|
||||
assert.equal(beforePublish.brand.tagline, originalBrand.tagline);
|
||||
const published = await request("/admin/releases/publish", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
payload: { note: "集成测试发布" },
|
||||
});
|
||||
assert.equal(published.statusCode, 201);
|
||||
const first = JSON.parse(published.body);
|
||||
assert.equal(first.version, 2);
|
||||
assert.equal(first.status, "published");
|
||||
assert.equal(
|
||||
JSON.parse((await request("/public/workspace")).body).brand.tagline,
|
||||
"集成测试待发布标语",
|
||||
);
|
||||
const draftOnlyForm = await prisma.inquiryForm.create({
|
||||
data: {
|
||||
brandId,
|
||||
name: "未发布的草稿表单",
|
||||
fieldsSnapshot: [{ key: "phone", type: "phone", label: "手机", required: true }],
|
||||
},
|
||||
});
|
||||
const draftSubmission = await request("/customer/inquiry-submissions", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
payload: { formId: draftOnlyForm.id, values: { phone: "13871112222" } },
|
||||
});
|
||||
assert.equal(draftSubmission.statusCode, 400);
|
||||
|
||||
const listed = await request("/admin/releases", {
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
assert.equal(listed.statusCode, 200);
|
||||
assert.equal(JSON.parse(listed.body)[0].version, 2);
|
||||
|
||||
const concurrent = await Promise.all(
|
||||
["并发发布 A", "并发发布 B"].map((note) =>
|
||||
request("/admin/releases/publish", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
payload: { note },
|
||||
}),
|
||||
),
|
||||
);
|
||||
assert.deepEqual(
|
||||
concurrent.map((item) => item.statusCode),
|
||||
[201, 201],
|
||||
);
|
||||
assert.deepEqual(
|
||||
concurrent.map((item) => JSON.parse(item.body).version).sort((a, b) => a - b),
|
||||
[3, 4],
|
||||
);
|
||||
|
||||
const rolledBack = await request("/admin/releases/1/rollback", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
assert.equal(rolledBack.statusCode, 201);
|
||||
assert.equal(JSON.parse(rolledBack.body).version, 5);
|
||||
assert.equal(
|
||||
JSON.parse((await request("/public/workspace")).body).brand.tagline,
|
||||
originalBrand.tagline,
|
||||
);
|
||||
|
||||
const revoked = await request("/admin/releases/revoke", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
payload: {},
|
||||
});
|
||||
assert.equal(revoked.statusCode, 201);
|
||||
assert.equal(JSON.parse(revoked.body).status, "revoked");
|
||||
assert.equal(JSON.parse(revoked.body).revokedBy, readIdentity(adminToken).subject);
|
||||
const unpublished = JSON.parse((await request("/public/workspace")).body);
|
||||
assert.equal(unpublished.publication.status, "unpublished");
|
||||
assert.equal(unpublished.brand, null);
|
||||
assert.deepEqual(unpublished.offerings, []);
|
||||
assert.deepEqual(JSON.parse((await request("/public/offerings")).body), []);
|
||||
const revokedSubmission = await request("/customer/inquiry-submissions", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
payload: { formId: draftOnlyForm.id, values: { phone: "13871112222" } },
|
||||
});
|
||||
assert.equal(revokedSubmission.statusCode, 400);
|
||||
const revokedBooking = await request("/customer/bookings", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
payload: {
|
||||
requestType: "inquiry",
|
||||
customerName: "集成测试客户",
|
||||
wechatId: "integration-wechat",
|
||||
contactPreference: "wechat",
|
||||
},
|
||||
});
|
||||
assert.equal(revokedBooking.statusCode, 400);
|
||||
await prisma.inquiryForm.delete({ where: { id: draftOnlyForm.id } });
|
||||
await prisma.brandProfile.update({
|
||||
where: { id: brandId },
|
||||
data: { tagline: originalBrand.tagline },
|
||||
});
|
||||
assert.equal((await publishReleaseForTests("恢复集成测试基线")).statusCode, 201);
|
||||
});
|
||||
|
||||
async function request(url, options = {}) {
|
||||
return app
|
||||
.getHttpAdapter()
|
||||
@@ -32,6 +205,19 @@ async function request(url, options = {}) {
|
||||
.inject({ method: "GET", url, ...options });
|
||||
}
|
||||
|
||||
async function publishReleaseForTests(note = "集成测试发布") {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const token = JSON.parse(login.body).token;
|
||||
return request("/admin/releases/publish", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { note },
|
||||
});
|
||||
}
|
||||
|
||||
test("health and public content are available without authentication", async () => {
|
||||
const health = await request("/health");
|
||||
assert.equal(health.statusCode, 200);
|
||||
@@ -68,6 +254,91 @@ test("health and public content are available without authentication", async ()
|
||||
assert.equal(missingSlug.statusCode, 404);
|
||||
});
|
||||
|
||||
test("visual template compatibility is enforced by catalog, preview, and brand switching", async () => {
|
||||
const catalog = await request("/public/templates");
|
||||
assert.equal(catalog.statusCode, 200);
|
||||
const visuals = JSON.parse(catalog.body).visuals;
|
||||
assert.deepEqual(
|
||||
visuals.find((visual) => visual.key === "linjing-editorial").supportedIndustryTemplates,
|
||||
["personal", "doors"],
|
||||
);
|
||||
const incompatiblePreview = await request(
|
||||
"/public/templates/preview?industry=food&visual=linjing-editorial",
|
||||
);
|
||||
assert.equal(incompatiblePreview.statusCode, 400);
|
||||
const compatiblePreview = await request(
|
||||
"/public/templates/preview?industry=doors&visual=linjing-editorial",
|
||||
);
|
||||
assert.equal(compatiblePreview.statusCode, 200);
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const token = JSON.parse(login.body).token;
|
||||
const compatibleSwitch = await request("/admin/config/brand", {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { config: { visualTemplateKey: "acheng-campus-food" } },
|
||||
});
|
||||
assert.equal(compatibleSwitch.statusCode, 200);
|
||||
});
|
||||
|
||||
test("seeded public workspaces keep personal, food, and doors brands isolated", async () => {
|
||||
const expected = [
|
||||
{
|
||||
slug: "linran-brand",
|
||||
id: "00000000-0000-0000-0000-000000000003",
|
||||
templateKey: "personal",
|
||||
founder: "林然",
|
||||
offeringKind: "service",
|
||||
categoryLabel: "策略咨询",
|
||||
},
|
||||
{
|
||||
slug: "default-brand",
|
||||
id: "00000000-0000-0000-0000-000000000001",
|
||||
templateKey: "food",
|
||||
founder: "阿成",
|
||||
offeringKind: "package",
|
||||
categoryLabel: "套餐",
|
||||
},
|
||||
{
|
||||
slug: "linjing-doors",
|
||||
id: "00000000-0000-0000-0000-000000000002",
|
||||
templateKey: "doors",
|
||||
founder: "林叙安 (Lin XUAN)",
|
||||
offeringKind: "product",
|
||||
categoryLabel: "入户大门",
|
||||
},
|
||||
];
|
||||
const workspaces = await Promise.all(
|
||||
expected.map(async (item) => {
|
||||
const response = await request(`/public/workspace?brandSlug=${item.slug}`);
|
||||
assert.equal(response.statusCode, 200);
|
||||
const workspace = JSON.parse(response.body);
|
||||
assert.equal(workspace.brand.id, item.id);
|
||||
assert.equal(workspace.template.key, item.templateKey);
|
||||
assert.ok(workspace.visualTemplate?.key);
|
||||
assert.ok(workspace.visualTemplateManifest?.pages?.length > 0);
|
||||
assert.equal(workspace.brand.founder, item.founder);
|
||||
assert.ok(workspace.trustContent.length > 0);
|
||||
assert.ok(workspace.trustPresentation);
|
||||
assert.ok(workspace.inquiryForm);
|
||||
assert.equal(workspace.inquiryForm.isEnabled, true);
|
||||
assert.ok(workspace.offerings.length > 0);
|
||||
assert.ok(workspace.offerings.every((offering) => offering.brandId === undefined));
|
||||
assert.ok(
|
||||
workspace.offerings.some(
|
||||
(offering) =>
|
||||
offering.kind === item.offeringKind &&
|
||||
offering.presentation?.categoryLabel === item.categoryLabel,
|
||||
),
|
||||
);
|
||||
return workspace;
|
||||
}),
|
||||
);
|
||||
assert.equal(new Set(workspaces.map((workspace) => workspace.brand.id)).size, 3);
|
||||
});
|
||||
|
||||
test("public workspace uses brand-scoped capability installations and preserves status", async () => {
|
||||
await prisma.capabilityInstallation.deleteMany({ where: { brandId } });
|
||||
const installation = await prisma.capabilityInstallation.create({
|
||||
@@ -80,6 +351,8 @@ test("public workspace uses brand-scoped capability installations and preserves
|
||||
},
|
||||
});
|
||||
try {
|
||||
const published = await publishReleaseForTests();
|
||||
assert.equal(published.statusCode, 201);
|
||||
const response = await request("/public/workspace");
|
||||
assert.equal(response.statusCode, 200);
|
||||
const body = JSON.parse(response.body);
|
||||
@@ -125,6 +398,135 @@ test("admin can update declared capability status with authorization and audit",
|
||||
await prisma.capabilityAuditLog.deleteMany({ where: { brandId } });
|
||||
});
|
||||
|
||||
test("editor membership can manage brand content but cannot change system settings", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const token = JSON.parse(login.body).token;
|
||||
const identity = readIdentity(token);
|
||||
const membership = await prisma.brandMembership.findUnique({
|
||||
where: { adminUserId_brandId: { adminUserId: identity.subject, brandId } },
|
||||
});
|
||||
assert.ok(membership);
|
||||
await prisma.brandMembership.update({ where: { id: membership.id }, data: { role: "editor" } });
|
||||
try {
|
||||
const offerings = await request("/admin/workspace/offerings", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(offerings.statusCode, 200);
|
||||
const capabilities = await request("/admin/workspace/capabilities", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(capabilities.statusCode, 403);
|
||||
const visualHistory = await request("/admin/config/visual-template/history", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(visualHistory.statusCode, 403);
|
||||
const visualUpdate = await request("/admin/config/brand", {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { config: { visualTemplateKey: "unknown-visual" } },
|
||||
});
|
||||
assert.equal(visualUpdate.statusCode, 403);
|
||||
} finally {
|
||||
await prisma.brandMembership.update({
|
||||
where: { id: membership.id },
|
||||
data: { role: membership.role },
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("owner can manage brand members without removing the final owner", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const token = JSON.parse(login.body).token;
|
||||
const identity = readIdentity(token);
|
||||
const members = await request("/admin/brands/members", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(members.statusCode, 200);
|
||||
const current = JSON.parse(members.body).find((item) => item.adminUserId === identity.subject);
|
||||
assert.ok(current);
|
||||
const selfDisable = await request(`/admin/brands/members/${current.id}`, {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { isEnabled: false },
|
||||
});
|
||||
assert.equal(selfDisable.statusCode, 400);
|
||||
const created = await request("/admin/brands/members", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: {
|
||||
username: `editor-${Date.now()}`,
|
||||
displayName: "测试编辑",
|
||||
password: "test-password-123",
|
||||
role: "editor",
|
||||
},
|
||||
});
|
||||
assert.equal(created.statusCode, 201);
|
||||
const guestMembership = JSON.parse(created.body);
|
||||
try {
|
||||
const updated = await request(`/admin/brands/members/${guestMembership.id}`, {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { isEnabled: false },
|
||||
});
|
||||
assert.equal(updated.statusCode, 200);
|
||||
assert.equal(JSON.parse(updated.body).isEnabled, false);
|
||||
} finally {
|
||||
await prisma.brandMembership.delete({ where: { id: guestMembership.id } });
|
||||
await prisma.adminUser.delete({ where: { id: guestMembership.adminUser.id } });
|
||||
}
|
||||
});
|
||||
|
||||
test("manually created member must change the initial password before normal use", async () => {
|
||||
const ownerLogin = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const ownerToken = JSON.parse(ownerLogin.body).token;
|
||||
const username = `first-login-${Date.now()}`;
|
||||
const created = await request("/admin/brands/members", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${ownerToken}` },
|
||||
payload: {
|
||||
username,
|
||||
displayName: "首次登录测试",
|
||||
password: "initial-password-123",
|
||||
role: "editor",
|
||||
},
|
||||
});
|
||||
assert.equal(created.statusCode, 201);
|
||||
const member = JSON.parse(created.body);
|
||||
assert.equal(member.adminUser.mustChangePassword, undefined);
|
||||
try {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username, password: "initial-password-123" },
|
||||
});
|
||||
assert.equal(login.statusCode, 201);
|
||||
assert.equal(JSON.parse(login.body).mustChangePassword, true);
|
||||
const changed = await request("/admin/session/change-password", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${JSON.parse(login.body).token}` },
|
||||
payload: { currentPassword: "initial-password-123", newPassword: "updated-password-123" },
|
||||
});
|
||||
assert.equal(changed.statusCode, 201);
|
||||
const updatedLogin = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username, password: "updated-password-123" },
|
||||
});
|
||||
assert.equal(updatedLogin.statusCode, 201);
|
||||
assert.equal(JSON.parse(updatedLogin.body).mustChangePassword, false);
|
||||
} finally {
|
||||
await prisma.brandMembership.delete({ where: { id: member.id } });
|
||||
await prisma.adminUser.delete({ where: { id: member.adminUser.id } });
|
||||
}
|
||||
});
|
||||
|
||||
test("admin can install optional quote capability without industry-specific branching", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
@@ -138,6 +540,7 @@ test("admin can install optional quote capability without industry-specific bran
|
||||
});
|
||||
assert.equal(response.statusCode, 200);
|
||||
assert.equal(JSON.parse(response.body).capabilityKey, "quote-request");
|
||||
assert.equal((await publishReleaseForTests()).statusCode, 201);
|
||||
const workspace = await request("/public/workspace");
|
||||
assert.ok(JSON.parse(workspace.body).plugins.some((plugin) => plugin.key === "quote-request"));
|
||||
await prisma.capabilityInstallation.deleteMany({
|
||||
@@ -204,16 +607,13 @@ test("admin can install doors industry template through the shared runtime contr
|
||||
const workspace = await request("/public/workspace");
|
||||
assert.equal(workspace.statusCode, 200);
|
||||
const body = JSON.parse(workspace.body);
|
||||
assert.equal(body.template.key, "doors");
|
||||
assert.ok(body.modules.some((item) => item.type === "offering"));
|
||||
assert.ok(body.modules.some((item) => item.type === "inquiry"));
|
||||
assert.deepEqual(
|
||||
body.runtimeCapabilities.map((item) => item.key),
|
||||
["offerings", "inquiry"],
|
||||
);
|
||||
assert.ok(Array.isArray(body.offerings));
|
||||
assert.ok(Array.isArray(body.fields));
|
||||
assert.ok(body.fields.every((field) => typeof field.key === "string"));
|
||||
assert.equal(body.template.key, "food");
|
||||
assert.equal(body.publication.status, "published");
|
||||
const samplePreview = await request("/admin/workspace/sample-content/preview", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(samplePreview.statusCode, 200);
|
||||
assert.equal(JSON.parse(samplePreview.body).templateKey, "doors");
|
||||
} finally {
|
||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId } });
|
||||
await prisma.brandModule.deleteMany({ where: { brandId } });
|
||||
@@ -222,6 +622,8 @@ test("admin can install doors industry template through the shared runtime contr
|
||||
});
|
||||
|
||||
test("admin can preview and import sample content idempotently", async () => {
|
||||
const originalBrand = await prisma.brandProfile.findUnique({ where: { id: brandId } });
|
||||
await prisma.brandProfile.update({ where: { id: brandId }, data: { templateKey: "doors" } });
|
||||
await prisma.offering.deleteMany({
|
||||
where: {
|
||||
brandId,
|
||||
@@ -262,6 +664,10 @@ test("admin can preview and import sample content idempotently", async () => {
|
||||
});
|
||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId, source: "sample" } });
|
||||
await prisma.capabilityAuditLog.deleteMany({ where: { brandId, capabilityKey: "doors" } });
|
||||
await prisma.brandProfile.update({
|
||||
where: { id: brandId },
|
||||
data: { templateKey: originalBrand?.templateKey ?? "food" },
|
||||
});
|
||||
});
|
||||
|
||||
test("admin can install a template and public workspace exposes enabled configuration", async () => {
|
||||
@@ -284,7 +690,7 @@ test("admin can install a template and public workspace exposes enabled configur
|
||||
});
|
||||
assert.equal(installed.statusCode, 201);
|
||||
assert.equal(JSON.parse(installed.body).template.key, "personal");
|
||||
assert.equal(JSON.parse(installed.body).visualTemplate.key, "minimal-neutral");
|
||||
assert.equal(JSON.parse(installed.body).visualTemplate.key, "linjing-editorial");
|
||||
assert.equal(JSON.parse(installed.body).installation.configSnapshot.schemaVersion, "1.0");
|
||||
try {
|
||||
const previewUnauthorized = await request("/admin/workspace/template/preview");
|
||||
@@ -324,19 +730,11 @@ test("admin can install a template and public workspace exposes enabled configur
|
||||
assert.equal(publicWorkspace.statusCode, 200);
|
||||
const workspaceBody = JSON.parse(publicWorkspace.body);
|
||||
assert.equal(workspaceBody.contractVersion, "1.0");
|
||||
assert.equal(workspaceBody.template.key, "personal");
|
||||
assert.deepEqual(workspaceBody.capabilities, [
|
||||
{ key: "offerings", version: "1.0.0", status: "enabled", config: {} },
|
||||
{ key: "inquiry", version: "1.0.0", status: "enabled", config: {} },
|
||||
]);
|
||||
assert.deepEqual(workspaceBody.runtimeCapabilities, [
|
||||
{ key: "offerings", version: "1.0.0", status: "enabled", config: {} },
|
||||
{ key: "inquiry", version: "1.0.0", status: "enabled", config: {} },
|
||||
]);
|
||||
assert.equal(workspaceBody.modules.length, 5);
|
||||
assert.equal(workspaceBody.runtimeModules.length, 5);
|
||||
assert.equal(workspaceBody.template.key, "food");
|
||||
assert.ok(workspaceBody.modules.length > 0);
|
||||
assert.equal(workspaceBody.modules.length, workspaceBody.runtimeModules.length);
|
||||
assert.equal(workspaceBody.runtimeModules[0].schemaVersion, "1.0");
|
||||
assert.equal(workspaceBody.inquiryForm, null);
|
||||
assert.ok(workspaceBody.inquiryForm);
|
||||
const conflict = await request("/admin/workspace/install", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
@@ -424,18 +822,18 @@ test("admin visual template selection is reflected in public runtime workspace",
|
||||
const updated = await request("/admin/config/brand", {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { config: { visualTemplateKey: "minimal-neutral" } },
|
||||
payload: { config: { visualTemplateKey: "acheng-campus-food" } },
|
||||
});
|
||||
assert.equal(updated.statusCode, 200);
|
||||
try {
|
||||
const runtime = await request("/public/workspace");
|
||||
assert.equal(runtime.statusCode, 200);
|
||||
const body = JSON.parse(runtime.body);
|
||||
assert.equal(body.visualTemplate.key, "minimal-neutral");
|
||||
assert.equal(body.visualTemplate.key, "acheng-campus-food");
|
||||
assert.equal(body.visualTemplate.version, "1.0.0");
|
||||
assert.equal(body.theme.colors.accent, "#4B5563");
|
||||
assert.equal(body.visualTemplate.variants.hero, "minimal");
|
||||
assert.equal(body.visualTemplateManifest.key, "minimal-neutral");
|
||||
assert.equal(body.theme.colors.accent, "#E87532");
|
||||
assert.equal(body.visualTemplate.variants.hero, "stall-board");
|
||||
assert.equal(body.visualTemplateManifest.key, "acheng-campus-food");
|
||||
assert.equal(body.visualTemplateManifest.brandFirst, true);
|
||||
assert.deepEqual(
|
||||
body.visualTemplateManifest.pages.map((page) => page.key),
|
||||
@@ -450,6 +848,50 @@ test("admin visual template selection is reflected in public runtime workspace",
|
||||
}
|
||||
});
|
||||
|
||||
test("public workspace exposes declared brand and trust presentation data", async () => {
|
||||
const doorsBrand = await prisma.brandProfile.findUnique({ where: { slug: "linjing-doors" } });
|
||||
assert.ok(doorsBrand);
|
||||
const original = doorsBrand;
|
||||
await prisma.brandProfile.update({
|
||||
where: { id: doorsBrand.id },
|
||||
data: {
|
||||
config: {
|
||||
...(original?.config && typeof original.config === "object" ? original.config : {}),
|
||||
homeHero: { title: "尚未发布的集成测试首页标题" },
|
||||
},
|
||||
},
|
||||
});
|
||||
try {
|
||||
const runtime = await request("/public/workspace?brandSlug=linjing-doors");
|
||||
assert.equal(runtime.statusCode, 200);
|
||||
const body = JSON.parse(runtime.body);
|
||||
assert.equal(body.brand.founder, "林叙安 (Lin XUAN)");
|
||||
assert.equal(body.brand.title, "高端门系统建筑研造主理人");
|
||||
assert.notEqual(body.brand.homeHero.title, "尚未发布的集成测试首页标题");
|
||||
assert.equal(body.trustPresentation.stats.length, 4);
|
||||
assert.equal(body.trustPresentation.pillars.length, 3);
|
||||
assert.equal(body.trustPresentation.serviceFlow.length, 6);
|
||||
assert.equal(body.brand.profilePresentation.coverage.length, 2);
|
||||
assert.equal(body.brand.profilePresentation.warranty.length, 4);
|
||||
assert.equal(body.brand.visualPresentation.home.proofTitle, "14 年,只做门与空间的关系");
|
||||
assert.equal(body.brand.visualPresentation.inquiry.submitLabel, "提交量房与定制评估需求");
|
||||
assert.equal(body.brand.visualPresentation.records.emptyAction, "开始咨询");
|
||||
assert.equal(body.offerings.length, 4);
|
||||
assert.ok(body.offerings.every((offering) => offering.presentation.heroImage));
|
||||
assert.ok(
|
||||
body.offerings.every((offering) => offering.presentation.details.materialsList.length),
|
||||
);
|
||||
const doorType = body.inquiryForms[0].fields.find((field) => field.key === "doorType");
|
||||
assert.equal(doorType.options.length, 5);
|
||||
assert.equal(doorType.options[0].value, "入户大门(防暴铸铜 / 实木)");
|
||||
} finally {
|
||||
await prisma.brandProfile.update({
|
||||
where: { id: doorsBrand.id },
|
||||
data: { config: original?.config ?? {} },
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("admin can create and version an inquiry form", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
@@ -537,6 +979,7 @@ test("admin can create and version an inquiry form", async () => {
|
||||
});
|
||||
assert.equal(blockedCapability.statusCode, 400);
|
||||
await prisma.capabilityInstallation.delete({ where: { id: capability.id } });
|
||||
assert.equal((await publishReleaseForTests()).statusCode, 201);
|
||||
const publicForm = await request(`/public/inquiry-forms/${id}`);
|
||||
assert.equal(publicForm.statusCode, 200);
|
||||
const publicOffering = await request(`/public/offerings/${offering.id}`);
|
||||
@@ -554,6 +997,13 @@ test("admin can create and version an inquiry form", async () => {
|
||||
(form) => form.key === id,
|
||||
);
|
||||
assert.deepEqual(runtimeForm.fields[1].options, [{ label: "微信", value: "wechat" }]);
|
||||
await prisma.inquiryForm.update({
|
||||
where: { id },
|
||||
data: {
|
||||
version: 3,
|
||||
fieldsSnapshot: [{ key: "draft_only", type: "text", label: "草稿字段", required: true }],
|
||||
},
|
||||
});
|
||||
const submission = await request("/customer/inquiry-submissions", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
@@ -561,6 +1011,7 @@ test("admin can create and version an inquiry form", async () => {
|
||||
});
|
||||
assert.equal(submission.statusCode, 201);
|
||||
assert.equal(JSON.parse(submission.body).formVersion, 2);
|
||||
assert.equal(JSON.parse(submission.body).fieldsSnapshot[0].key, "budget");
|
||||
assert.equal(JSON.parse(submission.body).offeringId, offering.id);
|
||||
assert.deepEqual(JSON.parse(submission.body).values, { budget: 1000 });
|
||||
assert.equal((await request("/customer/inquiry-submissions")).statusCode, 401);
|
||||
@@ -687,10 +1138,10 @@ test("admin can manage offerings and public endpoint hides disabled offerings",
|
||||
assert.equal(listed.statusCode, 200);
|
||||
assert.ok(JSON.parse(listed.body).some((item) => item.id === id));
|
||||
const publicItem = await request(`/public/offerings/${id}`);
|
||||
assert.equal(publicItem.statusCode, 200);
|
||||
assert.equal(publicItem.statusCode, 400);
|
||||
const publicList = await request("/public/offerings");
|
||||
assert.equal(publicList.statusCode, 200);
|
||||
assert.ok(JSON.parse(publicList.body).some((item) => item.id === id));
|
||||
assert.ok(!JSON.parse(publicList.body).some((item) => item.id === id));
|
||||
const updated = await request(`/admin/workspace/offerings/${id}`, {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
@@ -705,7 +1156,7 @@ test("admin can manage offerings and public endpoint hides disabled offerings",
|
||||
payload: { isEnabled: true },
|
||||
});
|
||||
assert.equal(reenabled.statusCode, 200);
|
||||
assert.equal((await request(`/public/offerings/${id}`)).statusCode, 200);
|
||||
assert.equal((await request(`/public/offerings/${id}`)).statusCode, 400);
|
||||
} finally {
|
||||
const deleted = await request(`/admin/workspace/offerings/${id}`, {
|
||||
method: "DELETE",
|
||||
@@ -936,7 +1387,7 @@ test("admin can read and update brand and service configuration", async () => {
|
||||
const projectedService = JSON.parse(publicServices.body).find(
|
||||
(item) => item.id === serviceBefore.id,
|
||||
);
|
||||
assert.equal(projectedService.priceText, "集成测试价格");
|
||||
assert.equal(projectedService.priceText, serviceBefore.priceText);
|
||||
|
||||
const listedServices = await request("/admin/workspace/offerings", {
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
@@ -981,6 +1432,57 @@ test("admin can read and update brand and service configuration", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("admin can update user-facing brand presentation without replacing other config", async () => {
|
||||
assert.equal(
|
||||
(await request("/admin/config/presentation", { method: "PATCH", payload: { home: {} } }))
|
||||
.statusCode,
|
||||
401,
|
||||
);
|
||||
assert.equal(
|
||||
(
|
||||
await request("/admin/config/presentation", {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
payload: { home: {} },
|
||||
})
|
||||
).statusCode,
|
||||
403,
|
||||
);
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const token = JSON.parse(login.body).token;
|
||||
const brand = await prisma.brandProfile.findUnique({ where: { id: brandId } });
|
||||
assert.ok(brand);
|
||||
const originalConfig = brand.config;
|
||||
try {
|
||||
const response = await request("/admin/config/presentation", {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: {
|
||||
identity: { founder: "可编辑主理人", title: "品牌主理人", ignoredNumber: 123 },
|
||||
home: { proofTitle: "用户可编辑的信任标题", ignoredNumber: 123 },
|
||||
inquiry: { submitLabel: "开始沟通" },
|
||||
},
|
||||
});
|
||||
assert.equal(response.statusCode, 200);
|
||||
const presentation = JSON.parse(response.body).visualPresentation;
|
||||
assert.equal(presentation.home.proofTitle, "用户可编辑的信任标题");
|
||||
assert.equal(presentation.home.ignoredNumber, undefined);
|
||||
assert.equal(presentation.inquiry.submitLabel, "开始沟通");
|
||||
const runtime = await request("/public/workspace");
|
||||
assert.notEqual(JSON.parse(runtime.body).brand.founder, "可编辑主理人");
|
||||
assert.notEqual(JSON.parse(runtime.body).brand.title, "品牌主理人");
|
||||
assert.notEqual(
|
||||
JSON.parse(runtime.body).brand.visualPresentation.home.proofTitle,
|
||||
"用户可编辑的信任标题",
|
||||
);
|
||||
} finally {
|
||||
await prisma.brandProfile.update({ where: { id: brandId }, data: { config: originalConfig } });
|
||||
}
|
||||
});
|
||||
|
||||
test("admin can manage trust content", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
@@ -1004,7 +1506,7 @@ test("admin can manage trust content", async () => {
|
||||
const publicContent = await request("/public/trust-content");
|
||||
assert.equal(publicContent.statusCode, 200);
|
||||
const publicItems = JSON.parse(publicContent.body);
|
||||
assert.ok(publicItems.some((item) => item.id === id));
|
||||
assert.ok(!publicItems.some((item) => item.id === id));
|
||||
assert.ok(!publicItems.some((item) => item.id === JSON.parse(draft.body).id));
|
||||
try {
|
||||
const list = await request("/admin/config/trust-content", {
|
||||
@@ -1047,6 +1549,33 @@ test("wechat login validates the request DTO before exchanging the code", async
|
||||
assert.equal(response.statusCode, 400);
|
||||
});
|
||||
|
||||
test("wechat login creates a customer session for the requested brand", async () => {
|
||||
const doorsBrand = await prisma.brandProfile.findUnique({ where: { slug: "linjing-doors" } });
|
||||
assert.ok(doorsBrand);
|
||||
const sessionOpenid = `doors-login-${Date.now()}`;
|
||||
const wechatAuth = app.get(WechatAuthService);
|
||||
const originalExchangeCode = wechatAuth.exchangeCode;
|
||||
wechatAuth.exchangeCode = async () => ({ openid: sessionOpenid });
|
||||
try {
|
||||
const response = await request("/customer/session/wechat?brandSlug=linjing-doors", {
|
||||
method: "POST",
|
||||
payload: { code: "test-code" },
|
||||
});
|
||||
assert.equal(response.statusCode, 201);
|
||||
const identity = readIdentity(JSON.parse(response.body).token);
|
||||
assert.equal(identity.brandId, doorsBrand.id);
|
||||
assert.equal(identity.role, "customer");
|
||||
assert.ok(
|
||||
await prisma.customerUser.findUnique({
|
||||
where: { brandId_openid: { brandId: doorsBrand.id, openid: sessionOpenid } },
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
wechatAuth.exchangeCode = originalExchangeCode;
|
||||
await prisma.customerUser.deleteMany({ where: { openid: sessionOpenid } });
|
||||
}
|
||||
});
|
||||
|
||||
test("customer booking DTO rejects incomplete package requests", async () => {
|
||||
const response = await request("/customer/bookings", {
|
||||
method: "POST",
|
||||
@@ -1087,6 +1616,16 @@ test("customer can create and cancel a package booking", async () => {
|
||||
where: { brandId, isEnabled: true, priceAmount: { not: null } },
|
||||
});
|
||||
assert.ok(service);
|
||||
const release = await prisma.brandRelease.findFirst({
|
||||
where: { brandId, status: "published" },
|
||||
orderBy: { version: "desc" },
|
||||
});
|
||||
const publishedOffering = release?.snapshot?.offerings?.find?.((item) => item.id === service.id);
|
||||
assert.ok(publishedOffering);
|
||||
await prisma.offering.update({
|
||||
where: { id: service.id },
|
||||
data: { priceAmount: service.priceAmount + 500, name: `${service.name}草稿` },
|
||||
});
|
||||
const created = await request("/customer/bookings", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
@@ -1098,14 +1637,20 @@ test("customer can create and cancel a package booking", async () => {
|
||||
items: [{ offeringId: service.id, quantity: 2 }],
|
||||
},
|
||||
});
|
||||
await prisma.offering.update({
|
||||
where: { id: service.id },
|
||||
data: { priceAmount: service.priceAmount, name: service.name },
|
||||
});
|
||||
assert.equal(created.statusCode, 201);
|
||||
const createdBody = JSON.parse(created.body);
|
||||
assert.equal(createdBody.estimatedAmount, service.priceAmount * 2);
|
||||
assert.equal(createdBody.estimatedAmount, publishedOffering.priceAmount * 2);
|
||||
const booking = await prisma.booking.findUnique({ where: { bookingNo: createdBody.bookingNo } });
|
||||
assert.ok(booking);
|
||||
assert.equal(booking.workflowKey, "booking.basic");
|
||||
assert.equal(booking.currentState, "received");
|
||||
assert.equal(booking.offeringId, service.id);
|
||||
const bookingItem = await prisma.bookingItem.findFirst({ where: { bookingId: booking.id } });
|
||||
assert.equal(bookingItem?.serviceNameSnapshot, publishedOffering.name);
|
||||
const initialTransitions = await prisma.bookingStateTransition.findMany({
|
||||
where: { bookingId: booking.id },
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
const { randomBytes } = require("node:crypto");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
const { PrismaClient } = require("@prisma/client");
|
||||
|
||||
const databaseUrl = process.env.DATABASE_URL;
|
||||
if (!databaseUrl) throw new Error("DATABASE_URL is required for integration tests");
|
||||
|
||||
const schema = `pb_test_${randomBytes(8).toString("hex")}`;
|
||||
const testUrl = new URL(databaseUrl);
|
||||
testUrl.searchParams.set("schema", schema);
|
||||
const testEnvironment = { ...process.env, DATABASE_URL: testUrl.toString(), NODE_ENV: "test" };
|
||||
const administrator = new PrismaClient();
|
||||
|
||||
function run(command, args) {
|
||||
const result = spawnSync(command, args, { stdio: "inherit", env: testEnvironment });
|
||||
if (result.error) throw result.error;
|
||||
return result.status ?? 1;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
let created = false;
|
||||
let status = 1;
|
||||
try {
|
||||
await administrator.$executeRawUnsafe(`CREATE SCHEMA "${schema}"`);
|
||||
created = true;
|
||||
if (run("pnpm", ["exec", "prisma", "migrate", "deploy"]) !== 0) return status;
|
||||
if (run("pnpm", ["db:seed"]) !== 0) return status;
|
||||
status = run(process.execPath, ["--test", "test/http.integration.test.js"]);
|
||||
return status;
|
||||
} finally {
|
||||
if (created) await administrator.$executeRawUnsafe(`DROP SCHEMA "${schema}" CASCADE`);
|
||||
await administrator.$disconnect();
|
||||
process.exitCode = status;
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
Reference in new issue
Block a user