From 4ff0b171b9dde9f0d9e776ad710d5a55bb0812eb Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 22 Nov 2024 10:58:55 +0800 Subject: [PATCH] fix: ceate instances of audit tasks that are filtered by project --- sqle/api/controller/v1/instance_audit_plan.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sqle/api/controller/v1/instance_audit_plan.go b/sqle/api/controller/v1/instance_audit_plan.go index f91eb9d52..f7e93d086 100644 --- a/sqle/api/controller/v1/instance_audit_plan.go +++ b/sqle/api/controller/v1/instance_audit_plan.go @@ -109,8 +109,13 @@ func CreateInstanceAuditPlan(c echo.Context) error { return controller.JSONBaseErrorReq(c, err) } + instID, err := strconv.Atoi(req.InstanceId) + if err != nil { + return controller.JSONBaseErrorReq(c, err) + } + // check instance - inst, exist, err := dms.GetInstancesById(c.Request().Context(), req.InstanceId) + inst, exist, err := dms.GetInstanceInProjectById(c.Request().Context(), projectUid, uint64(instID)) if !exist { return controller.JSONBaseErrorReq(c, ErrInstanceNotExist) } else if err != nil {