feat(社区版项目管理):#3676 转发forge评论相关接口

This commit is contained in:
wanjia 2025-07-29 14:52:22 +08:00
parent 225b2f3a24
commit d42947ad9d
3 changed files with 74 additions and 0 deletions

View File

@ -100,4 +100,49 @@ public class PmsForgeApiForwardController {
JSONObject result = pmsForgeApiForwardService.deleteForgeIssue(repo, owner, issue_id); JSONObject result = pmsForgeApiForwardService.deleteForgeIssue(repo, owner, issue_id);
return success(result); return success(result);
} }
@PostMapping("{owner}/{repo}/issues/{issue_id}/journals")
@ApiOperation("创建疑修评论")
public AjaxResult createIssueComment(@ApiParam(name = "repo", value = "仓库标识") @PathVariable String repo,
@ApiParam(name = "owner", value = "仓库拥有者") @PathVariable String owner,
@ApiParam(name = "issue_id", value = "疑修id") @PathVariable Long issue_id,
@Validated @RequestBody JSONObject issue) {
JSONObject result = pmsForgeApiForwardService.createIssueComment(repo, owner, issue_id, issue);
return success(result);
}
@GetMapping("{owner}/{repo}/issues/{issue_id}/journals")
@ApiOperation("获取疑修评论列表")
public AjaxResult getIssueCommentList(@ApiParam(name = "repo", value = "仓库标识") @PathVariable String repo,
@ApiParam(name = "owner", value = "仓库拥有者") @PathVariable String owner,
@ApiParam(name = "issue_id", value = "疑修id") @PathVariable Long issue_id,
@ApiParam(name = "category", value = "评论类型") String category,
@ApiParam(name = "page", value = "页码") Integer page,
@ApiParam(name = "limit", value = "每页记录数") Integer limit
) {
JSONObject result = pmsForgeApiForwardService.getIssueCommentList(repo, owner, issue_id, category, page, limit);
return success(result);
}
@PatchMapping("{owner}/{repo}/issues/{issue_id}/journals/{journal_id}")
@ApiOperation("修改疑修评论详情")
public AjaxResult updateIssueComment(@ApiParam(name = "repo", value = "仓库标识") @PathVariable String repo,
@ApiParam(name = "owner", value = "仓库拥有者") @PathVariable String owner,
@ApiParam(name = "issue_id", value = "疑修id") @PathVariable Long issue_id,
@ApiParam(name = "journal_id", value = "疑修评论id") @PathVariable Long journal_id,
@RequestBody JSONObject issue) {
JSONObject result = pmsForgeApiForwardService.updateIssueComment(repo, owner, issue_id, journal_id, issue);
return success(result);
}
@DeleteMapping("{owner}/{repo}/issues/{issue_id}/journals/{journal_id}")
@ApiOperation("删除疑修评论")
public AjaxResult deleteIssueComment(@ApiParam(name = "repo", value = "仓库标识") @PathVariable String repo,
@ApiParam(name = "owner", value = "仓库拥有者") @PathVariable String owner,
@ApiParam(name = "issue_id", value = "疑修id") @PathVariable Long issue_id,
@ApiParam(name = "journal_id", value = "疑修评论id") @PathVariable Long journal_id) {
JSONObject result = pmsForgeApiForwardService.deleteIssueComment(repo, owner, issue_id, journal_id);
return success(result);
}
} }

View File

@ -51,4 +51,21 @@ public class PmsForgeApiForwardService {
public JSONObject deleteForgeIssue(String repo, String owner, String issueId) { public JSONObject deleteForgeIssue(String repo, String owner, String issueId) {
return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ISSUE(repo, owner, issueId)); return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ISSUE(repo, owner, issueId));
} }
public JSONObject createIssueComment(String repo, String owner, Long issueId, JSONObject issue) {
return gitLinkRequestHelper.doPost(
PmsGitLinkRequestUrl.ADD_REPO_ISSUE_JOURNAL(issueId, owner, repo), issue);
}
public JSONObject getIssueCommentList(String repo, String owner, Long issueId, String category, Integer page, Integer limit) {
return gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE_COMMENT_LIST(issueId, owner, repo, category, page, limit));
}
public JSONObject updateIssueComment(String repo, String owner, Long issueId, Long journalId, JSONObject issue) {
return gitLinkRequestHelper.doPatch(PmsGitLinkRequestUrl.UPDATE_ISSUE_COMMENT(issueId, owner, repo, journalId), issue);
}
public JSONObject deleteIssueComment(String repo, String owner, Long issueId, Long journalId) {
return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ISSUE_COMMENT(issueId, owner, repo, journalId));
}
} }

View File

@ -503,4 +503,16 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
public static GitLinkRequestUrl DELETE_ISSUE(String repo, String owner, String issueId) { public static GitLinkRequestUrl DELETE_ISSUE(String repo, String owner, String issueId) {
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/issues/%s", owner, repo, issueId)); return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/issues/%s", owner, repo, issueId));
} }
public static GitLinkRequestUrl GET_ISSUE_COMMENT_LIST(Long issueId, String owner, String repo, String category, Integer page, Integer limit) {
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/issues/%s/journals?category=%s&page=%s&limit=%s", owner, repo, issueId, category, page, limit));
}
public static GitLinkRequestUrl UPDATE_ISSUE_COMMENT(Long issueId, String owner, String repo, Long journalId) {
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/issues/%s/journals/%s", owner, repo, issueId, journalId));
}
public static GitLinkRequestUrl DELETE_ISSUE_COMMENT(Long issueId, String owner, String repo, Long journalId) {
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/issues/%s/journals/%s", owner, repo, issueId, journalId));
}
} }