Files
persionalBrand/apps/api/test/route-coverage.matrix.ts
T
que01 d0a0eeea8c
CI / Browser smoke (pull_request) Successful in 58s
CI / Static checks (pull_request) Successful in 1m32s
CI / API integration (pull_request) Successful in 1m27s
CI / Production build (pull_request) Successful in 2m7s
feat: 支持按品牌配置微信登录凭据
2026-10-23 22:07:39 +08:00

675 lines
23 KiB
TypeScript

export type HttpMethod = "DELETE" | "GET" | "PATCH" | "POST" | "PUT";
export type RouteAuth = "public" | "customer" | "token" | "brand" | "roles" | "template-admin";
export type RouteCoverage = {
method: HttpMethod;
path: string;
auth: RouteAuth;
roles?: string[];
authorizationTest: string | null;
successTest: string;
};
export const ROUTE_COVERAGE: RouteCoverage[] = [
{
method: "DELETE",
path: "/admin/config/trust-content/:id",
auth: "brand",
authorizationTest: "admin can manage trust content",
successTest: "admin can manage trust content",
},
{
method: "DELETE",
path: "/admin/workspace/fields/:id",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "admin can customize workspace fields with brand isolation",
successTest: "admin can customize workspace fields with brand isolation",
},
{
method: "DELETE",
path: "/admin/workspace/offerings/:id",
auth: "brand",
authorizationTest: "admin can manage offerings and public endpoint hides disabled offerings",
successTest: "admin can manage offerings and public endpoint hides disabled offerings",
},
{
method: "GET",
path: "/admin/bookings",
auth: "brand",
authorizationTest: "admin booking endpoints reject missing or customer credentials",
successTest: "seeded admin can log in and read protected booking resources",
},
{
method: "GET",
path: "/admin/bookings/:id",
auth: "brand",
authorizationTest: "admin can inspect booking follow-up and tags",
successTest: "admin can inspect booking follow-up and tags",
},
{
method: "GET",
path: "/admin/bookings/tags",
auth: "brand",
authorizationTest: "admin can inspect booking follow-up and tags",
successTest: "admin can inspect booking follow-up and tags",
},
{
method: "GET",
path: "/admin/bookings/unread-count",
auth: "brand",
authorizationTest: "seeded admin can log in and read protected booking resources",
successTest: "seeded admin can log in and read protected booking resources",
},
{
method: "GET",
path: "/admin/brands",
auth: "brand",
authorizationTest: "admin can list and switch only enabled brand memberships",
successTest: "admin can list and switch only enabled brand memberships",
},
{
method: "GET",
path: "/admin/brands/creation-options",
auth: "roles",
roles: ["owner"],
authorizationTest: "brand creation options are owner-scoped",
successTest: "brand creation options are owner-scoped",
},
{
method: "GET",
path: "/admin/brands/members",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "manually created member must change the initial password before normal use",
successTest: "owner can manage brand members without removing the final owner",
},
{
method: "GET",
path: "/admin/config/brand",
auth: "brand",
authorizationTest: "admin can read and update brand and service configuration",
successTest: "admin can read and update brand and service configuration",
},
{
method: "GET",
path: "/admin/config/trust-content",
auth: "brand",
authorizationTest: "admin can manage trust content",
successTest: "admin can manage trust content",
},
{
method: "GET",
path: "/admin/miniapp-releases",
auth: "brand",
authorizationTest: "miniapp release tasks are authorized, idempotent, and state checked",
successTest: "miniapp release tasks are authorized, idempotent, and state checked",
},
{
method: "GET",
path: "/admin/miniapp-releases/latest",
auth: "brand",
authorizationTest: "miniapp release tasks are authorized, idempotent, and state checked",
successTest: "miniapp release tasks are authorized, idempotent, and state checked",
},
{
method: "GET",
path: "/admin/miniapp-releases/settings",
auth: "brand",
authorizationTest: "miniapp release settings never expose or persist plaintext credentials",
successTest: "miniapp release settings never expose or persist plaintext credentials",
},
{
method: "GET",
path: "/admin/releases",
auth: "brand",
authorizationTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
successTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
},
{
method: "GET",
path: "/admin/releases/readiness",
auth: "brand",
authorizationTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
successTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
},
{
method: "GET",
path: "/admin/session/current",
auth: "token",
authorizationTest:
"admin session cookie drives current session and rejects invalid credentials",
successTest: "admin session cookie drives current session and rejects invalid credentials",
},
{
method: "GET",
path: "/admin/template-operations/failures",
auth: "template-admin",
authorizationTest: "模板失败指标仅平台模板管理员可查,按窗口聚合且不暴露操作内容",
successTest: "模板失败指标仅平台模板管理员可查,按窗口聚合且不暴露操作内容",
},
{
method: "GET",
path: "/admin/templates",
auth: "template-admin",
authorizationTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
successTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
},
{
method: "GET",
path: "/admin/templates/:id/audit",
auth: "template-admin",
authorizationTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
successTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
},
{
method: "GET",
path: "/admin/templates/:id/preview",
auth: "template-admin",
authorizationTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
successTest: "平台模板管理员可以按行业预览版本,且预览不写入品牌数据",
},
{
method: "GET",
path: "/admin/uploads/config",
auth: "brand",
authorizationTest: "admin upload endpoints authorize and persist local media",
successTest: "admin upload endpoints authorize and persist local media",
},
{
method: "GET",
path: "/admin/workspace",
auth: "brand",
authorizationTest: "admin can customize workspace fields with brand isolation",
successTest: "admin can customize workspace fields with brand isolation",
},
{
method: "GET",
path: "/admin/workspace/capabilities",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "admin can update declared capability status with authorization and audit",
successTest: "admin capability list includes template defaults and brand overrides",
},
{
method: "GET",
path: "/admin/workspace/forms",
auth: "brand",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "GET",
path: "/admin/workspace/offerings",
auth: "brand",
authorizationTest: "admin can manage offerings and public endpoint hides disabled offerings",
successTest: "admin can read and update brand and service configuration",
},
{
method: "GET",
path: "/admin/workspace/preview",
auth: "brand",
authorizationTest: "admin preview workspace is authorized and brand-scoped draft runtime",
successTest: "admin preview workspace is authorized and brand-scoped draft runtime",
},
{
method: "GET",
path: "/admin/workspace/sample-content/preview",
auth: "brand",
authorizationTest: "admin can preview and import sample content idempotently",
successTest: "admin can preview and import sample content idempotently",
},
{
method: "GET",
path: "/admin/workspace/submissions",
auth: "brand",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "GET",
path: "/admin/workspace/template/preview",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "template ledger install, upgrade preview, and rollback stay brand-scoped",
successTest: "template ledger install, upgrade preview, and rollback stay brand-scoped",
},
{
method: "GET",
path: "/admin/workspace/template/options",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "page scheme options are readable by owners and admins only",
successTest: "page scheme options are readable by owners and admins only",
},
{
method: "GET",
path: "/customer/bookings",
auth: "customer",
authorizationTest: "customer booking endpoints require a valid customer session",
successTest: "customer booking endpoints require a valid customer session",
},
{
method: "GET",
path: "/customer/inquiry-submissions",
auth: "customer",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "GET",
path: "/customer/inquiry-submissions/:id",
auth: "customer",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "GET",
path: "/health",
auth: "public",
authorizationTest: null,
successTest: "health and public content are available without authentication",
},
{
method: "GET",
path: "/public/brand",
auth: "public",
authorizationTest: null,
successTest: "health and public content are available without authentication",
},
{
method: "GET",
path: "/public/inquiry-forms/:id",
auth: "public",
authorizationTest: null,
successTest: "admin can create and version an inquiry form",
},
{
method: "GET",
path: "/public/offerings",
auth: "public",
authorizationTest: null,
successTest: "health and public content are available without authentication",
},
{
method: "GET",
path: "/public/offerings/:id",
auth: "public",
authorizationTest: null,
successTest: "admin can manage offerings and public endpoint hides disabled offerings",
},
{
method: "GET",
path: "/public/templates",
auth: "public",
authorizationTest: null,
successTest:
"visual template compatibility is enforced by catalog, preview, and version selection",
},
{
method: "GET",
path: "/public/templates/:key",
auth: "public",
authorizationTest: null,
successTest: "health and public content are available without authentication",
},
{
method: "GET",
path: "/public/templates/preview",
auth: "public",
authorizationTest: null,
successTest:
"visual template compatibility is enforced by catalog, preview, and version selection",
},
{
method: "GET",
path: "/public/trust-content",
auth: "public",
authorizationTest: null,
successTest: "admin can manage trust content",
},
{
method: "GET",
path: "/public/workspace",
auth: "public",
authorizationTest: null,
successTest: "health and public content are available without authentication",
},
{
method: "PATCH",
path: "/admin/brands/members/:id",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "owner can manage brand members without removing the final owner",
successTest: "owner can manage brand members without removing the final owner",
},
{
method: "PATCH",
path: "/admin/config/brand",
auth: "brand",
authorizationTest: "admin can read and update brand and service configuration",
successTest: "admin can read and update brand and service configuration",
},
{
method: "PATCH",
path: "/admin/config/presentation",
auth: "brand",
authorizationTest:
"admin can update user-facing brand presentation without replacing other config",
successTest: "admin can update user-facing brand presentation without replacing other config",
},
{
method: "PATCH",
path: "/admin/config/trust-content/:id",
auth: "brand",
authorizationTest: "admin can manage trust content",
successTest: "admin can manage trust content",
},
{
method: "PATCH",
path: "/admin/miniapp-releases/:id/status",
auth: "brand",
authorizationTest: "miniapp release tasks are authorized, idempotent, and state checked",
successTest: "miniapp release tasks are authorized, idempotent, and state checked",
},
{
method: "PATCH",
path: "/admin/miniapp-releases/settings",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "miniapp release settings never expose or persist plaintext credentials",
successTest: "miniapp release settings never expose or persist plaintext credentials",
},
{
method: "PATCH",
path: "/admin/workspace/capabilities/:key",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "admin can update declared capability status with authorization and audit",
successTest: "admin can update declared capability status with authorization and audit",
},
{
method: "PATCH",
path: "/admin/workspace/fields/:id",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "admin can customize workspace fields with brand isolation",
successTest: "admin can customize workspace fields with brand isolation",
},
{
method: "PATCH",
path: "/admin/workspace/forms/:id",
auth: "brand",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "PATCH",
path: "/admin/workspace/offerings/:id",
auth: "brand",
authorizationTest: "admin can manage offerings and public endpoint hides disabled offerings",
successTest: "admin can manage offerings and public endpoint hides disabled offerings",
},
{
method: "PATCH",
path: "/admin/workspace/submissions/:id",
auth: "brand",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "POST",
path: "/admin/bookings/:id/read",
auth: "brand",
authorizationTest: "admin can inspect booking follow-up and tags",
successTest: "admin can inspect booking follow-up and tags",
},
{
method: "POST",
path: "/admin/bookings/:id/status",
auth: "brand",
authorizationTest: "admin can advance booking status but cannot skip the state machine",
successTest: "admin can advance booking status but cannot skip the state machine",
},
{
method: "POST",
path: "/admin/bookings/:id/tags",
auth: "brand",
authorizationTest: "admin can inspect booking follow-up and tags",
successTest: "admin can inspect booking follow-up and tags",
},
{
method: "POST",
path: "/admin/bookings/tags",
auth: "brand",
authorizationTest: "admin can inspect booking follow-up and tags",
successTest: "admin can inspect booking follow-up and tags",
},
{
method: "POST",
path: "/admin/brands/:brandId/switch",
auth: "brand",
authorizationTest: "admin can list and switch only enabled brand memberships",
successTest: "admin can list and switch only enabled brand memberships",
},
{
method: "POST",
path: "/admin/brands",
auth: "roles",
roles: ["owner"],
authorizationTest: "owner can create an isolated brand",
successTest: "owner can create an isolated brand",
},
{
method: "POST",
path: "/admin/brands/members",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "owner can manage brand members without removing the final owner",
successTest: "owner can manage brand members without removing the final owner",
},
{
method: "POST",
path: "/admin/config/trust-content",
auth: "brand",
authorizationTest: "admin can manage trust content",
successTest: "admin can manage trust content",
},
{
method: "POST",
path: "/admin/miniapp-releases",
auth: "brand",
authorizationTest: "miniapp release tasks are authorized, idempotent, and state checked",
successTest: "miniapp release tasks are authorized, idempotent, and state checked",
},
{
method: "POST",
path: "/admin/miniapp-releases/:id/upload",
auth: "brand",
authorizationTest: "miniapp release tasks are authorized, idempotent, and state checked",
successTest: "miniapp release tasks are authorized, idempotent, and state checked",
},
{
method: "POST",
path: "/admin/releases/:version/rollback",
auth: "brand",
authorizationTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
successTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
},
{
method: "POST",
path: "/admin/releases/publish",
auth: "brand",
authorizationTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
successTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
},
{
method: "POST",
path: "/admin/releases/revoke",
auth: "brand",
authorizationTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
successTest: "admin release lifecycle is authorized, brand-scoped, and versioned",
},
{
method: "POST",
path: "/admin/session/change-password",
auth: "token",
authorizationTest: "changing an admin password revokes existing admin tokens",
successTest: "changing an admin password revokes existing admin tokens",
},
{
method: "POST",
path: "/admin/session/login",
auth: "public",
authorizationTest: null,
successTest: "admin logout revokes the current token",
},
{
method: "POST",
path: "/admin/session/logout",
auth: "token",
authorizationTest: "admin logout revokes the current token",
successTest: "admin logout revokes the current token",
},
{
method: "POST",
path: "/admin/templates/:id/publish",
auth: "template-admin",
authorizationTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
successTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
},
{
method: "POST",
path: "/admin/templates/:id/retire",
auth: "template-admin",
authorizationTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
successTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
},
{
method: "POST",
path: "/admin/templates/import",
auth: "template-admin",
authorizationTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
successTest: "模板目录只允许平台模板管理员访问,并支持安全、幂等导入",
},
{
method: "POST",
path: "/admin/uploads/presign",
auth: "brand",
authorizationTest: "admin upload endpoints authorize and persist local media",
successTest: "admin upload endpoints authorize and persist local media",
},
{
method: "POST",
path: "/admin/workspace/fields",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "admin can customize workspace fields with brand isolation",
successTest: "admin can customize workspace fields with brand isolation",
},
{
method: "POST",
path: "/admin/workspace/forms",
auth: "brand",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "POST",
path: "/admin/workspace/install",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "industry template state has a single source of truth",
successTest: "industry template state has a single source of truth",
},
{
method: "POST",
path: "/admin/workspace/offerings",
auth: "brand",
authorizationTest: "admin can manage offerings and public endpoint hides disabled offerings",
successTest: "admin can manage offerings and public endpoint hides disabled offerings",
},
{
method: "POST",
path: "/admin/workspace/sample-content/import",
auth: "brand",
authorizationTest: "admin can preview and import sample content idempotently",
successTest: "admin can preview and import sample content idempotently",
},
{
method: "POST",
path: "/admin/workspace/template/rollback",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "template ledger install, upgrade preview, and rollback stay brand-scoped",
successTest: "template ledger install, upgrade preview, and rollback stay brand-scoped",
},
{
method: "POST",
path: "/admin/workspace/template/select-version",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "selected package version is reflected in public runtime workspace",
successTest:
"visual template compatibility is enforced by catalog, preview, and version selection",
},
{
method: "POST",
path: "/admin/workspace/template/upgrade",
auth: "roles",
roles: ["owner", "admin", "platform-admin"],
authorizationTest: "template ledger install, upgrade preview, and rollback stay brand-scoped",
successTest: "template ledger install, upgrade preview, and rollback stay brand-scoped",
},
{
method: "POST",
path: "/customer/bookings",
auth: "customer",
authorizationTest: "customer booking endpoints require a valid customer session",
successTest: "customer can create a generic inquiry without food-specific fields",
},
{
method: "POST",
path: "/customer/bookings/:id/cancel",
auth: "customer",
authorizationTest: "customer can create and cancel a package booking",
successTest: "customer can create and cancel a package booking",
},
{
method: "POST",
path: "/customer/inquiry-submissions",
auth: "customer",
authorizationTest: "admin can create and version an inquiry form",
successTest: "admin can create and version an inquiry form",
},
{
method: "POST",
path: "/customer/session/logout",
auth: "customer",
authorizationTest: "customer logout revokes the current token",
successTest: "customer logout revokes the current token",
},
{
method: "POST",
path: "/customer/session/wechat",
auth: "public",
authorizationTest: null,
successTest: "wechat login creates a customer session using the requested brand credentials",
},
{
method: "POST",
path: "/admin/client-errors",
auth: "brand",
authorizationTest: "admin client error reports are authenticated, validated, and deduplicated",
successTest: "admin client error reports are authenticated, validated, and deduplicated",
},
{
method: "PUT",
path: "/admin/uploads/local",
auth: "brand",
authorizationTest: "admin upload endpoints authorize and persist local media",
successTest: "admin upload endpoints authorize and persist local media",
},
];