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

重构 audit 相关代码, 改为面向对象实现 #2348

Merged
merged 7 commits into from
Nov 3, 2023

Conversation

LeoQuote
Copy link
Collaborator

@LeoQuote LeoQuote commented Oct 24, 2023

audit 的代码实现的比较死, 没有模块化, 二次开发时不方便, 本 pr 将audit 相关代码转成面向对象的实现, 把 SqlWorkflow, WorkflowAudit 等对象作为属性传给新的 audit class, 方便audit 在处置时读取相关对象的信息, 进行个性化处置.

这次抽象出了

  • create_audit
  • operate
    两个顶层方法, 可以给 view 层调用, 分别用来创建审批流和 操作审批流

还有

  • generate_audit_setting
  • operate_pass
  • operate_reject
  • operate_abort

这几个小方法, 可供二次开发时继承覆盖

如开发者需要实现个性化审批流程, 可以预先建立权限组, 继承 AuditV2 , 并重新实现 generate_audit_setting 方法, 即可实现简单的自定义审批流.

@request-info
Copy link

request-info bot commented Oct 24, 2023

你好!感谢你反馈的问题/bug,但是你的描述好像是空的,我们需要你完整的信息,这样才能帮你解决问题 如果不知道怎么写,在新建issue的时候有若干个模板可供选择,祝好!

@hhyo

This comment was marked as off-topic.

@LeoQuote

This comment was marked as off-topic.

sql/archiver.py Fixed Show fixed Hide fixed
sql/archiver.py Fixed Show fixed Hide fixed
@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Attention: 82 lines in your changes are missing coverage. Please review.

Comparison is base (3cdfba0) 75.71% compared to head (328bd2f) 75.95%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2348      +/-   ##
==========================================
+ Coverage   75.71%   75.95%   +0.24%     
==========================================
  Files         108      111       +3     
  Lines       15727    15736       +9     
==========================================
+ Hits        11907    11953      +46     
+ Misses       3820     3783      -37     
Files Coverage Δ
archery/settings.py 53.48% <100.00%> (+0.36%) ⬆️
common/utils/const.py 100.00% <100.00%> (ø)
sql/models.py 97.05% <100.00%> (+0.47%) ⬆️
sql/test_model.py 100.00% <100.00%> (ø)
sql/tests.py 99.35% <100.00%> (+0.56%) ⬆️
sql/utils/test_workflow_audit.py 100.00% <100.00%> (ø)
sql/utils/tests.py 100.00% <100.00%> (ø)
sql_api/serializers.py 79.88% <100.00%> (ø)
sql_api/tests.py 100.00% <ø> (ø)
conftest.py 93.75% <93.75%> (ø)
... and 5 more

... and 1 file with indirect coverage changes

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

@LeoQuote LeoQuote marked this pull request as ready for review November 1, 2023 06:52
@LeoQuote LeoQuote merged commit ba985e9 into hhyo:master Nov 3, 2023
10 checks passed
@LeoQuote LeoQuote deleted the refactor_audit branch November 3, 2023 06:24
finovy pushed a commit to finovy/Archery that referenced this pull request Nov 10, 2023
* 重构 audit 相关代码, 改为面向对象实现

* 使用 pytst 运行测试

* fix tests

* fix coverage generation

* more coverage

* 修复 audit_groups 的类型错误

* 不抛错给用户, 改为输出日志
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.

2 participants