Skip to content

docs: add DDD logical architecture diagram for signing module#445

Open
zengchen1024 wants to merge 1 commit intoreviewfrom
zengchen1024-3.26
Open

docs: add DDD logical architecture diagram for signing module#445
zengchen1024 wants to merge 1 commit intoreviewfrom
zengchen1024-3.26

Conversation

@zengchen1024
Copy link
Copy Markdown
Collaborator

描述

相关 Issue

变更类型

  • Bug 修复
  • 新功能
  • 代码重构
  • 文档更新
  • 样式改进
  • 性能优化
  • 测试相关
  • 其他

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@opensourceways-bot
Copy link
Copy Markdown

CLA Signature Pass

zengchen1024, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot
Copy link
Copy Markdown

Linking Issue Notice

@zengchen1024 , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在通过引入一份详细的架构文档,显著提升对 signing 模块设计和内部运作的理解。这份文档不仅提供了基于领域驱动设计(DDD)的逻辑架构视图,还深入阐述了各层职责、关键设计原则、核心聚合根以及主要业务流程,为开发者和维护者提供了清晰的指导,有助于未来的开发和故障排查。

Highlights

  • 新增 signing 模块的 DDD 逻辑架构图: 详细描述了 signing 模块基于领域驱动设计(DDD)的分层架构,包括适配器层、应用层、领域层、基础设施层和事件观察层。
  • 阐明了各层职责和关键设计特点: 明确了依赖倒置、值对象防腐、双存储策略和聚合根边界等设计原则,并列举了主要的聚合根及其职责。
  • 提供了核心业务流程示例: 通过“公司签署 CLA”和“用户登录”两个具体流程,展示了系统内部的交互和数据流转。
  • 包含 Mermaid 架构图: 提供了一个直观的 Mermaid 图,可视化了整个模块的架构和层间关系。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new ARCHITECTURE.md file, providing a comprehensive logical architecture overview for the signing module based on DDD principles. The documentation includes layer descriptions, key design features, main aggregates, core business flows, and both ASCII and Mermaid architecture diagrams. The review comments highlight several inconsistencies between this new documentation and the actual code implementation. Specifically, the documented 'Company Sign CLA' business flow incorrectly states that app.CorpSigningService.Sign() calls watch.SendCLAUpdatedEvent(), and the User aggregate root's UpdatePrivacy() method name in both diagrams does not match the UpdatePrivacyConsent() method in the signing/domain/user.go code.

├─ VCService.Verify()(验证码校验)
├─ new CorpSigning AR(聚合根创建,触发业务规则)
├─ CorpSigningRepo.Add()(MongoDB 持久化)
└─ watch.SendCLAUpdatedEvent()(发送 Kafka 事件)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

在“公司签署 CLA”的核心业务流程描述中,文档指出 app.CorpSigningService.Sign() 方法会调用 watch.SendCLAUpdatedEvent()。经核查 signing/app/corp_signing.go 中的代码,Sign 方法实现中并未调用此事件发送函数。此外,CLAUpdatedEvent 从命名上看更适用于 CLA 文档更新场景,而非公司签署场景。这种不一致可能会误导开发者,建议修正文档以反映真实的代码逻辑。

│ │ │ │ Manager │ │ ┌────────────────────┐ ┌─────────────────┐ │ │
│ │ │ │ (Entity) │ │ │ User AR │ │ Link AR │ │ │
│ │ │ ├───────────────┤ │ │ ChangePassword() │ │ AddCLA() │ │ │
│ │ │ │ Corporation │ │ │ UpdatePrivacy() │ │ FindCLA() │ │ │
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

User 聚合根的 ASCII 架构图中,方法被描述为 UpdatePrivacy()。然而,在领域模型代码 signing/domain/user.go 中,相应的方法是 UpdatePrivacyConsent()。为了确保文档与代码实现的一致性,建议更新此处的图表。如果因为图表宽度限制,可以考虑使用 UpdatePrivacyConsent 或调整图表布局。

D1["CorpSigning AR\n└ Representative\n└ Manager\n└ Corporation"]
D2["EmployeeSigning AR\nenable / disable / remove"]
D3["IndividualSigning AR\nAgreeNewCLA / HasSignedCLA"]
D4["User AR\nChangePassword / UpdatePrivacy"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在 Mermaid 架构图中,User 聚合根的方法被描述为 UpdatePrivacy。为了与代码 signing/domain/user.go 中的 UpdatePrivacyConsent() 方法保持一致,建议在此处也进行更新,以确保文档的准确性。

Suggested change
D4["User AR\nChangePassword / UpdatePrivacy"]
D4["User AR\nChangePassword / UpdatePrivacyConsent"]

@opensourceways-bot
Copy link
Copy Markdown

检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants