feat(announcements): admin/user announcement system #434
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概述
本 PR 完成公告系统 MVP(管理端 + 用户端),并解决了 ent 代码生成导致的
ent <-> internal/service循环依赖,使后端可正常go generate/go test。主要功能
后端
any_of(OR) /all_of(AND),条件类型:subscription:operator=in,按group_ids匹配当前有效订阅balance:operator=gt/gte/lt/lte/eq,按value比较前端
关键实现细节
1) 修复 ent/service 循环依赖
backend/internal/domain:承载 Ent schema 需要引用的常量与公告 targeting 类型/逻辑(不依赖 ent)。backend/ent/schema/*从internal/service改为引用internal/domain(彻底消除ent -> service)。backend/internal/service/domain_constants.go改为 re-exportinternal/domain常量,最大限度减少改动面。2) 生成代码更新
测试
cd backend && go test ./...备注
any_of/all_of),不引入 NOT/嵌套表达式。