Files
dacli/src/webapi/message.ts
T
sswandClaude b43b03f83a feat(test-render): add 6 TC-C cross-module real contract validation (role/msg/schedule/monitor/user/log, v0.14+)
v0.14+ §8.3.4 阶段 6: 加 6 个 TC-C 批量子模块, 跨模块真实契约校验, 跟 dict/form/menu/portal/workflow/di 标杆同模式.

每个模块 4 关卡 (list 字段 ⊆ api / form 字段 ⊆ api / 必填/外键/关联完整性 / schema 完整性),
可选 --id 追加第 5 关卡单条 getInfo 完整性.

模块差异:
- role: userColumns/Form.vue + conditionJson JSON.parse + enCode 格式 (Form.vue L44 formValidate)
- msg: notice (4 关卡 list/form/必填/schema) + msgTemplate (1 关卡 必填), notice webapi 修正 (system/message.ts)
- schedule: FullCalendar 6 事件字段 + Form.vue 19 字段 + 必填 10 + repetition JSON.parse + 时间序
- monitor: 4 视图 (msgMonitor/userOnline/flowMonitor/platformMonitor schema)
- user: 8 列表字段 + 27 表单字段 + 必填 3 + enabledMark/organizeId/gender schema
- log: 4 类别 (login=1/operate=3/error=4/request=5) list 字段 ⊆ api

已知 limitation:
- schedule webapi 镜像 Quartz cron (system/task.ts), 非日历日程. 需扩展加 getScheduleList.

Co-Authored-By: Claude <[email protected]>
2026-07-01 16:57:52 +08:00

42 lines
1.5 KiB
TypeScript

/**
* webapi/message.ts — 镜像 web 端 msgCenter/notice + msgTemplate (v0.11+ Phase 2)
*
* 镜像 2 个 web 文件 (12 函数):
* - web/api/msgCenter/notice.ts (5): getNoticeList, create, update, delNotice, sendNotice
* - web/api/msgCenter/msgTemplate.ts (7): getMsgTemplateList, create, update, getInfo, delMsgTemplate, copy, testMsgTemplate
*/
import { JnpfClient } from '../core/client.ts'
import { loadWebModule } from './_loader.ts'
const NOTICE_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/system/message.ts'
const MSG_TEMPLATE_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/msgCenter/msgTemplate.ts'
let cached: { notice: any; template: any } | null = null
export async function initWebapi(client: JnpfClient): Promise<void> {
if (cached) return
const { initDefHttpShim } = await import('./_defhttp_shim.ts')
initDefHttpShim(client)
const notice = await loadWebModule(NOTICE_SRC)
const template = await loadWebModule(MSG_TEMPLATE_SRC)
cached = { notice, template }
}
export function isWebapiLoaded(): boolean {
return cached !== null
}
export const loadNotice: any = new Proxy({} as any, {
get(_target, prop) {
if (!cached) throw new Error('message/notice 模块未初始化, 请先 await initWebapi(client)')
return cached.notice[prop]
},
})
export const loadMsgTemplate: any = new Proxy({} as any, {
get(_target, prop) {
if (!cached) throw new Error('message/template 模块未初始化, 请先 await initWebapi(client)')
return cached.template[prop]
},
})