fix(activity): close Phase 14 KEEP-VERIFY/EXTEND — 11 backend + 3 frontend-contract + 2 test-fidelity defects
Phase 14 (multi-type public-welfare activities) verification closure. Backend (D1-D11): - D1 CRITICAL: ActivityMapper.countRemainingCapacity had no @Select and no XML -> activity detail / register / approve all threw Invalid bound statement. Removed the shell; unified on ActivityRegistrationMapper. - D2 CRITICAL: register & approve were read-then-write -> oversold under concurrency. Replaced with single atomic SQL (insertIfCapacityAvailable / approveIfCapacityAvailable, affectedRows==0 => full). - D3 HIGH: activityType / orgRole never validated against production chk_activity_type / chk_org_role -> 500 only on PostgreSQL. - D4 HIGH: ActivityListItemDTO had no activityType -> miniapp category tabs always empty (Gate failure). - D5: male/female counts were fabricated as approvedCount/2; now real aggregation over user_profiles.gender. - D6: minAge/maxAge was a TODO no-op; added assertAgeInRange. - D7: registration_policy write-only; per-type eligibility now enforced (identity / local eligibility / gender quota). - D8: POST /operator/activities dropped type, multi-org and capacity groups and set organizer_org_id to the operator user id; now delegates to createActivityFromAdmin (single implementation). - D9: three operator write endpoints were mounted on the user-side ActivityController (dual implementation, zero callers) -> moved. - D10: NPE on soft-deleted activity in getMyActivities; NPE/500 on missing admin form fields (Instant.parse(null)); tolerant time parsing added. - D11: DTO lacked registeredCount / status / coverFileId / description -> card always showed 0 registered, "view detail", no cover, no summary. Frontend contract (F1-F3): - F1: miniapp category code "classroom" is not in the production whitelist (should be relationship_education); three types had no tab at all. - F2: ui-activity-card read 7 fields that do not exist on the backend; now reads only real DTO fields, plus per-type badge and eligibility hint. - F3: admin-web had no activity management page at all; added ActivityManagementView.vue (type-driven dynamic form, multi-org, capacity groups, publish/cancel) + /activities route and nav entry. Test fidelity (T1-T2): - T1: deleted two assertTrue(true) placeholder tests (testNoOverbooking, testNoDuplicateRegistration) that covered the exact broken invariants. - T2: test schema lacked V023 columns/constraints and three tables; the activity tables were only in the OPTIONAL set (zero coverage) -> schema completed and moved to REQUIRED_IN_TEST_SCHEMA. Tests: ActivityPhase14Test (23 cases), ActivityConstraintGuardTest (9 cases, parses real db/migration/V*.sql plus miniapp source). Two negative-verification rounds proved both guard families actually turn red. Regression: 450 tests / 0 failures / 0 errors / 3 skipped / BUILD SUCCESS (baseline 420). admin-web vue-tsc 0 error, vite build OK.
This commit is contained in:
@@ -52,12 +52,26 @@ Page({
|
||||
hasMore: true,
|
||||
firstLoaded: false,
|
||||
activeCategory: 'all',
|
||||
/**
|
||||
* 分类 Tabs。
|
||||
*
|
||||
* <p><b>Phase 14 修复</b>:code 必须**逐字等于**后端 {@code activities.activity_type}
|
||||
* 的取值(生产约束 {@code chk_activity_type} 白名单)。此前这里写的是
|
||||
* {@code classroom},而生产白名单里根本没有该值(婚恋课堂是
|
||||
* {@code relationship_education})—— 点「婚恋课堂」Tab 恒为空白页。
|
||||
*
|
||||
* <p>守卫 {@code ActivityConstraintGuardTest#miniappCategoryCodesWithinProductionWhitelist}
|
||||
* 会解析真实 DDL 校验本数组,改错即刻变红。
|
||||
*/
|
||||
categories: [
|
||||
{ code: 'all', label: '全部' },
|
||||
{ code: 'matchmaking', label: '公益联谊' },
|
||||
{ code: 'classroom', label: '婚恋课堂' },
|
||||
{ code: 'interest_social', label: '兴趣社交' },
|
||||
{ code: 'relationship_education', label: '婚恋课堂' },
|
||||
{ code: 'premarital_guidance', label: '婚前辅导' },
|
||||
{ code: 'marriage_custom_culture', label: '婚俗文化' },
|
||||
{ code: 'anti_fraud', label: '反诈宣传' },
|
||||
],
|
||||
] as ActivityCategory[],
|
||||
/** @type {{title:string, description:string, illustration:string, actions:Array}} */
|
||||
emptyConfig: {
|
||||
title: '暂无进行中的活动',
|
||||
|
||||
Reference in New Issue
Block a user