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

flow_approver #128

Merged
merged 14 commits into from
Aug 24, 2022
Merged

flow_approver #128

merged 14 commits into from
Aug 24, 2022

Conversation

QSummerY
Copy link
Contributor

@QSummerY QSummerY commented Aug 10, 2022

related: #114
审批流后续开发:

  • 增加 group_user 表记录用户组信息,使之在审批流中作为审批人并可复用
  • 抽象的 user provider, 屏蔽 bridge 代码细节
  • 审批节点格式增加approver_type字段,app_owner,group,people, 在 ticket 中增加 approver 的解析逻辑 -> 取到具体的人
  • 对于 people 方式,直接取审批人
  • 对于 group 方式,从node中approver字段取 group name, 再从group中获取对应的users
  • 对于 app_owner 方式,可从approver字段中设置某个app 取之owner作为审批人;也可使approver为空,从参数中获取app, 然后获取对应app的owner作为审批人
  • 在notify时增加notify_people字段,与approver字段区分

@QSummerY
Copy link
Contributor Author

@LeoQuote 基本功能应该差不多,有空review一下?

@@ -209,7 +229,8 @@ def check_confirmed(self):

def set_approval_log(self, by_user=SYSTEM_USER, operated_type="approved"):
approval_log = self.annotation.get("approval_log")
approval_log.append(dict(node=self.annotation.get("current_node"), approver=by_user, operated_type=operated_type, operated_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
operated_at = datetime.now().astimezone(timezone('Asia/Shanghai')).strftime("%Y-%m-%d %H:%M:%S")
Copy link
Contributor

Choose a reason for hiding this comment

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

保持现状? 记录 utc 时间如何? 以前是记录什么时间的?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

也可以,之前就是utc时间

Copy link
Contributor

Choose a reason for hiding this comment

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

那就 utc 时间, 通知渲染的时候再转成当地时间

@@ -162,6 +162,8 @@ async def ticket_op(ticket_id: int, op: str,
"申请人才可主动关闭工单"
if ticket.submitter != current_user.name:
raise HTTPException(status_code=403, detail='Permission denied, only submitter can close')
if ticket.status != "pending":
raise HTTPException(status_code=403, detail='Permission denied, can not close in this ticket status')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
raise HTTPException(status_code=403, detail='Permission denied, can not close in this ticket status')
raise HTTPException(status_code=400, detail='Ticket not pending, can not be closed')

Copy link
Contributor

@LeoQuote LeoQuote left a comment

Choose a reason for hiding this comment

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

LGTM

@LeoQuote LeoQuote merged commit 93c2b15 into douban:master Aug 24, 2022
@QSummerY QSummerY deleted the approvers_provider branch May 30, 2023 08:23
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