Skip to content

Commit

Permalink
chore:add token response
Browse files Browse the repository at this point in the history
  • Loading branch information
taolx0 committed Oct 25, 2024
1 parent 7fa0cff commit 40a9f70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sqle/api/controller/v1/instance_audit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ type AuditPlanTypeResBase struct {
AuditPlanId uint `json:"audit_plan_id"`
AuditPlanType string `json:"type"`
AuditPlanTypeDesc string `json:"desc"`
Token string `json:"token"`
}

type GetInstanceAuditPlansReqV1 struct {
Expand Down Expand Up @@ -519,7 +520,7 @@ func GetInstanceAuditPlans(c echo.Context) error {
typeBases := make([]AuditPlanTypeResBase, 0, len(auditPlanIds))
for _, auditPlanId := range auditPlanIds {
if auditPlanId != "" {
typeBase, err := ConvertAuditPlanTypeToResByID(c.Request().Context(), auditPlanId)
typeBase, err := ConvertAuditPlanTypeToResByID(c.Request().Context(), auditPlanId, v.Token)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down Expand Up @@ -547,7 +548,7 @@ func GetInstanceAuditPlans(c echo.Context) error {
})
}

func ConvertAuditPlanTypeToResByID(ctx context.Context, id string) (AuditPlanTypeResBase, error) {
func ConvertAuditPlanTypeToResByID(ctx context.Context, id string, token string) (AuditPlanTypeResBase, error) {
auditPlanID, err := strconv.Atoi(id)
if err != nil {
return AuditPlanTypeResBase{}, err
Expand All @@ -566,6 +567,7 @@ func ConvertAuditPlanTypeToResByID(ctx context.Context, id string) (AuditPlanTyp
AuditPlanType: auditPlan.Type,
AuditPlanTypeDesc: locale.Bundle.LocalizeMsgByCtx(ctx, meta.Desc),
AuditPlanId: auditPlan.ID,
Token: token,
}, nil
}
}
Expand Down
1 change: 1 addition & 0 deletions sqle/model/instance_audit_plan_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SELECT
instance_audit_plans.active_status,
instance_audit_plans.create_user_id,
instance_audit_plans.created_at,
instance_audit_plans.token,
audit_plans.audit_plan_ids
Expand Down

0 comments on commit 40a9f70

Please sign in to comment.