From ca8d15bc64c06c7ddc6d5446b86554a3aef48b99 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Sun, 31 Aug 2025 13:42:59 +0800 Subject: [PATCH] add mention user list api --- .../console/app/workflow_comment.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/api/controllers/console/app/workflow_comment.py b/api/controllers/console/app/workflow_comment.py index 6896ee6789..2cd76e6bfa 100644 --- a/api/controllers/console/app/workflow_comment.py +++ b/api/controllers/console/app/workflow_comment.py @@ -1,10 +1,11 @@ import logging -from flask_restful import Resource, marshal_with, reqparse +from flask_restful import Resource, fields, marshal_with, reqparse from controllers.console import api from controllers.console.app.wraps import get_app_model from controllers.console.wraps import account_initialization_required, setup_required +from fields.member_fields import account_with_role_fields from fields.workflow_comment_fields import ( workflow_comment_basic_fields, workflow_comment_create_fields, @@ -16,6 +17,7 @@ from fields.workflow_comment_fields import ( ) from libs.login import current_user, login_required from models import App +from services.account_service import TenantService from services.workflow_comment_service import WorkflowCommentService logger = logging.getLogger(__name__) @@ -216,6 +218,20 @@ class WorkflowCommentReplyDetailApi(Resource): return {"result": "success"}, 204 +class WorkflowCommentMentionUsersApi(Resource): + """API for getting mentionable users for workflow comments.""" + + @login_required + @setup_required + @account_initialization_required + @get_app_model + @marshal_with({"users": fields.List(fields.Nested(account_with_role_fields))}) + def get(self, app_model: App): + """Get all users in current tenant for mentions.""" + members = TenantService.get_tenant_members(current_user.current_tenant) + return {"users": members} + + # Register API routes api.add_resource(WorkflowCommentListApi, "/apps//workflow/comments") api.add_resource(WorkflowCommentDetailApi, "/apps//workflow/comments/") @@ -224,3 +240,4 @@ api.add_resource(WorkflowCommentReplyApi, "/apps//workflow/comments api.add_resource( WorkflowCommentReplyDetailApi, "/apps//workflow/comments//replies/" ) +api.add_resource(WorkflowCommentMentionUsersApi, "/apps//workflow/comments/mention-users")