AdminGetSkillLibrary godoc @Summary 后台技能详情 @Description 获取后台技能详情(含最新扫描结果与权限分组) @Tags 技能库-后台 @Accept json @Produce json @Security BearerAuth @Param id path int true "技能ID" @Success 200 {object} model.CommonResponse @Router /api/admin/skill-library/{id} [get]
(c *gin.Context)
| 357 | // @Success 200 {object} model.CommonResponse |
| 358 | // @Router /api/admin/skill-library/{id} [get] |
| 359 | func AdminGetSkillLibrary(c *gin.Context) { |
| 360 | skillID, err := strconv.ParseInt(c.Param("id"), 10, 64) |
| 361 | if err != nil || skillID <= 0 { |
| 362 | c.JSON(http.StatusBadRequest, model.ParamError.ToResponse(nil)) |
| 363 | return |
| 364 | } |
| 365 | |
| 366 | eid := config.GetEID(c) |
| 367 | svc := service.NewSkillLibraryService() |
| 368 | skillInfo, job, err := svc.GetSkillByIDForAdmin(c.Request.Context(), eid, skillID) |
| 369 | if err != nil { |
| 370 | toSkillAdminErrorResponse(c, err) |
| 371 | return |
| 372 | } |
| 373 | groupIDs := []int64{} |
| 374 | if skillInfo != nil { |
| 375 | groupIDs, err = model.GetResourcePermissionGroupIDs(skillID, model.ResourceTypeSkillLibrary) |
| 376 | if err != nil { |
| 377 | toSkillAdminErrorResponse(c, err) |
| 378 | return |
| 379 | } |
| 380 | } |
| 381 | c.JSON(http.StatusOK, model.Success.ToResponse(&AdminSkillDetailResponse{ |
| 382 | Skill: skillInfo, |
| 383 | GitHubURL: buildSkillGitHubURL(skillInfo), |
| 384 | LatestScanJob: job, |
| 385 | PermissionGroupIDs: groupIDs, |
| 386 | })) |
| 387 | } |
| 388 | |
| 389 | // AdminUpdateSkillLibrary godoc |
| 390 | // @Summary 后台更新技能信息 |
nothing calls this directly
no test coverage detected