liuyun 35028a69d2
Some checks are pending
CI / backend (push) Waiting to run
CI / frontend (push) Waiting to run
docs(spec): 归档 in-app-notification + 同步通知主 spec
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-11 22:26:15 +08:00

1.4 KiB
Raw Blame History

1. 数据模型与迁移

  • 1.1 Prisma:Notice(sys_notice,软删)+ NoticeRead(sys_notice_read,唯一 tenant_code+notice_id+user_id)
  • 1.2 生成并部署 migration

2. 后端 notices 模块

  • 2.1 Permissions 加 notice: { list, create, update, delete }
  • 2.2 新增 notices 模块(dto/service/controller/module),service extends BaseCrudService
  • 2.3 管理侧 CRUD:GET/POST/PATCH/DELETE /notices,挂权限 + @AuditLog
  • 2.4 用户侧:GET /notices/mine(enabled + 已读状态)、GET /notices/unread-count、POST /notices/:id/read、POST /notices/read-all(仅登录态)
  • 2.5 app.module.ts 注册 NoticesModule

3. 资源注册

  • 3.1 tenant-template 加 notice 菜单(parent=system)+ 管理侧接口资源
  • 3.2 存量租户跑 pnpm sync:resources

4. 前端

  • 4.1 api/notice.ts:类型 + 管理 CRUD + mine/unread-count/read/read-all
  • 4.2 notice store:未读数 + 列表 + 30s 轮询定时器
  • 4.3 ty-header 顶栏铃铛:el-badge 未读角标 + el-popover 列表 + 标记单条/全部已读
  • 4.4 通知管理页 pages/system/notice/index.vue(ty-crud,defineOptions({ name: 'notice' }))

5. 验证

  • 5.1 后端 build + 单测 + e2e 通过
  • 5.2 前端 type-check 通过
  • 5.3 冒烟:发布通知 → 未读数=1 → 标记已读 → 未读数=0