refactor(webhook): generalise controller routes
- Rename GitHubWebhookController to WebhookController - Move class-level mapping from /webhooks/github to /webhooks - Scope the GitHub endpoint to /webhooks/github via @PostMapping
This commit is contained in:
1 file changed
+6
-6
+6
-6
@@ -14,21 +14,21 @@ import org.springframework.web.bind.annotation.RequestHeader;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Tag(name = "GitHub WebHook")
|
@Tag(name = "WebHook")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/webhooks/github")
|
@RequestMapping("/webhooks")
|
||||||
public class GitHubWebhookController {
|
public class WebhookController {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(GitHubWebhookController.class);
|
private static final Logger log = LoggerFactory.getLogger(WebhookController.class);
|
||||||
|
|
||||||
private final WebhookService webhookService;
|
private final WebhookService webhookService;
|
||||||
|
|
||||||
public GitHubWebhookController(WebhookService webhookService) {
|
public WebhookController(WebhookService webhookService) {
|
||||||
this.webhookService = webhookService;
|
this.webhookService = webhookService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(description = "GitHub WebHook 接口")
|
@Operation(description = "GitHub WebHook 接口")
|
||||||
@PostMapping
|
@PostMapping("/github")
|
||||||
public ResponseEntity<Void> handleWebhook(
|
public ResponseEntity<Void> handleWebhook(
|
||||||
@RequestHeader(GitHubWebhookHeader.EVENT) String event,
|
@RequestHeader(GitHubWebhookHeader.EVENT) String event,
|
||||||
@RequestBody GitHubIssueRequest request
|
@RequestBody GitHubIssueRequest request
|
||||||
Reference in new issue
Block a user