Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tenant #2970

Merged
merged 2 commits into from
Nov 25, 2024
Merged

Tenant #2970

merged 2 commits into from
Nov 25, 2024

Conversation

KouShenhai
Copy link
Owner

@KouShenhai KouShenhai commented Nov 25, 2024

Summary by Sourcery

增强功能:

  • 在多个类中将 'sourceName' 重命名为 'sourcePrefix' 以更好地反映其用途。
Original summary in English

Summary by Sourcery

Enhancements:

  • Rename 'sourceName' to 'sourcePrefix' across multiple classes to better reflect its purpose.

Summary by CodeRabbit

  • New Features

    • Updated terminology from "source name" to "source prefix" across various components, enhancing clarity in data representation.
  • Bug Fixes

    • Adjusted data handling to ensure consistency with the new naming convention, which may improve data processing reliability.
  • Documentation

    • Comments and documentation updated to reflect changes from "source name" to "source prefix," ensuring accurate descriptions throughout the codebase.

Copy link

coderabbitai bot commented Nov 25, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request includes significant updates to the database schema and Java classes within the laokou project. Key changes involve the renaming of the source_name field to source_prefix across various classes and database tables, along with adjustments to comments and method signatures to reflect this new terminology. Additionally, several sequences in the PostgreSQL database are created or modified, ensuring they start from 1 and have appropriate maximum values. The changes primarily focus on enhancing consistency in naming conventions across the codebase.

Changes

File Change Summary
doc/db/kcloud_platform_domain.sql Created/modified sequences; renamed column source_name to source_prefix in boot_domain_event.
laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/context/UserContextHolder.java Renamed variable sourceName to sourcePrefix in User class.
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/convertor/DomainEventConvertor.java Updated method to assign sourcePrefix instead of sourceName.
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/entity/DomainEventDO.java Renamed variable sourceName to sourcePrefix.
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/model/DomainEventA.java Updated constructor to assign sourcePrefix instead of sourceName.
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/AggregateRoot.java Renamed variable sourceName to sourcePrefix.
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DefaultDomainEvent.java Updated constructors to use sourcePrefix instead of sourceName.
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DomainEvent.java Renamed field sourceName to sourcePrefix.
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/config/UserContextInterceptor.java Updated method to use sourcePrefix instead of sourceName.
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserDetail.java Renamed field and constructor parameter from sourceName to sourcePrefix.
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserUtil.java Renamed method from getSourceName to getSourcePrefix and changed access modifier for getAuthentication.
laokou-service/laokou-auth/laokou-auth-app/src/main/java/org/laokou/auth/event/handler/AbstractSendCaptchaEventHandler.java Updated method to use sourcePrefix instead of sourceName.
laokou-service/laokou-auth/laokou-auth-client/src/main/java/org/laokou/auth/dto/domainevent/NoticeMessageEvent.java Changed constructor parameter from sourceName to sourcePrefix.
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/ability/AuthDomainService.java Updated method to use sourcePrefix instead of sourceName.
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/gateway/SourceGateway.java Renamed method from getName to getPrefix.
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/AuthA.java Renamed method from updateSource to updateSourcePrefix.
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/SourceV.java Changed record parameter from name to prefix.
laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/convertor/UserConvertor.java Updated method to use sourcePrefix instead of sourceName.
laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/gatewayimpl/SourceGatewayImpl.java Renamed method from getName to getPrefix.

Possibly related issues

  • 租户管理 #2966: The changes in this PR may relate to tenant management, as the renaming of source_name to source_prefix could impact how tenant data is structured and accessed.

🐰 In the land of code where changes bloom,
A prefix now reigns, dispelling the gloom.
From names to prefixes, the shift is quite clear,
A hop towards clarity, let’s all give a cheer!
With sequences set, and tables anew,
Our rabbit hearts dance, for the changes are true! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@KouShenhai KouShenhai merged commit e17d587 into master Nov 25, 2024
6 of 10 checks passed
@KouShenhai KouShenhai deleted the tenant branch November 25, 2024 02:39
Copy link

sourcery-ai bot commented Nov 25, 2024

审核指南由 Sourcery 提供

此 PR 在代码库中将术语从 'sourceName' 更改为 'sourcePrefix',以更好地反映其作为数据源标识前缀的目的。更改包括重命名变量、方法和数据库列,同时保持现有功能。

更新的 boot_domain_event 表的 ER 图

erDiagram
    boot_domain_event {
        int8 aggregate_id
        varchar event_type
        varchar topic
        varchar source_prefix
        json attribute
        varchar service_id
        varchar tag
    }
Loading

更新的 UserDetail 类图

classDiagram
    class UserDetail {
        - Long tenantId
        - String sourcePrefix
        + UserDetail()
        + UserDetail(Long id, String username, String password, String avatar, Integer superAdmin, Integer status, String mail, String mobile, Set<String> deptPaths, Set<String> permissions, Long tenantId, String sourcePrefix)
        + boolean equals(Object o)
        + int hashCode()
    }
Loading

文件级更改

更改 详情 文件
在整个代码库中将 'sourceName' 重命名为 'sourcePrefix'
  • 在多个类中将字段从 'sourceName' 重命名为 'sourcePrefix'
  • 更新方法名称(例如,从 getSourceName 到 getSourcePrefix)
  • 修改 boot_domain_event 表中的数据库列名
  • 更新相关注释和文档
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserUtil.java
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserDetail.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DefaultDomainEvent.java
doc/db/kcloud_platform_domain.sql
laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/context/UserContextHolder.java
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/entity/DomainEventDO.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/AggregateRoot.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DomainEvent.java
重构与认证相关的代码以处理 sourcePrefix
  • 在 SourceGateway 接口中将方法从 getName 重命名为 getPrefix
  • 更新网关类中的方法实现
  • 修改认证流程以使用 sourcePrefix 术语
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/ability/AuthDomainService.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/AuthA.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/SourceV.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/gateway/SourceGateway.java
laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/gatewayimpl/SourceGatewayImpl.java
将 Authentication.getAuthentication() 方法设为私有
  • 将方法可见性从 public 更改为 private
  • 将方法移至类底部
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserUtil.java

提示和命令

与 Sourcery 互动

  • 触发新审核: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审核评论。
  • 从审核评论生成 GitHub 问题: 通过回复审核评论请求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题的任何地方写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何地方写 @sourcery-ai summary 以随时生成 PR 摘要。您也可以使用此命令指定摘要应插入的位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审核功能,例如 Sourcery 生成的拉取请求摘要、审核指南等。
  • 更改审核语言。
  • 添加、删除或编辑自定义审核说明。
  • 调整其他审核设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This PR implements a terminology change from 'sourceName' to 'sourcePrefix' across the codebase to better reflect its purpose as a prefix for data source identification. The change includes renaming variables, methods, and database columns while maintaining the existing functionality.

Updated ER diagram for boot_domain_event table

erDiagram
    boot_domain_event {
        int8 aggregate_id
        varchar event_type
        varchar topic
        varchar source_prefix
        json attribute
        varchar service_id
        varchar tag
    }
Loading

Updated class diagram for UserDetail

classDiagram
    class UserDetail {
        - Long tenantId
        - String sourcePrefix
        + UserDetail()
        + UserDetail(Long id, String username, String password, String avatar, Integer superAdmin, Integer status, String mail, String mobile, Set<String> deptPaths, Set<String> permissions, Long tenantId, String sourcePrefix)
        + boolean equals(Object o)
        + int hashCode()
    }
Loading

File-Level Changes

Change Details Files
Renamed 'sourceName' to 'sourcePrefix' throughout the codebase
  • Renamed field from 'sourceName' to 'sourcePrefix' in multiple classes
  • Updated method names (e.g., getSourceName to getSourcePrefix)
  • Modified database column name in boot_domain_event table
  • Updated related comments and documentation
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserUtil.java
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserDetail.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DefaultDomainEvent.java
doc/db/kcloud_platform_domain.sql
laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/context/UserContextHolder.java
laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/entity/DomainEventDO.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/AggregateRoot.java
laokou-common/laokou-common-i18n/src/main/java/org/laokou/common/i18n/dto/DomainEvent.java
Refactored authentication-related code for source prefix handling
  • Renamed method from getName to getPrefix in SourceGateway interface
  • Updated method implementations in gateway classes
  • Modified authentication flow to use sourcePrefix terminology
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/ability/AuthDomainService.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/AuthA.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/model/SourceV.java
laokou-service/laokou-auth/laokou-auth-domain/src/main/java/org/laokou/auth/gateway/SourceGateway.java
laokou-service/laokou-auth/laokou-auth-infrastructure/src/main/java/org/laokou/auth/gatewayimpl/SourceGatewayImpl.java
Made Authentication.getAuthentication() method private
  • Changed method visibility from public to private
  • Moved method to bottom of class
laokou-common/laokou-common-security/src/main/java/org/laokou/common/security/utils/UserUtil.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

@KouShenhai - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • 在 SourceGatewayImpl.getPrefix() 中,你仍然返回 sourceDO.getName(),这似乎与前缀重命名模式不一致。这里应该返回一个前缀值吗?
这是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey @KouShenhai - I've reviewed your changes - here's some feedback:

Overall Comments:

  • In SourceGatewayImpl.getPrefix(), you're still returning sourceDO.getName() which seems inconsistent with the prefix renaming pattern. Should this be returning a prefix value instead?
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 16.68%. Comparing base (e646533) to head (08dabd4).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
...org/laokou/common/i18n/dto/DefaultDomainEvent.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #2970   +/-   ##
=========================================
  Coverage     16.68%   16.68%           
  Complexity       74       74           
=========================================
  Files            89       89           
  Lines          1456     1456           
  Branches        111      111           
=========================================
  Hits            243      243           
  Misses         1184     1184           
  Partials         29       29           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant