-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommitFlowController.java
More file actions
35 lines (30 loc) · 1.36 KB
/
CommitFlowController.java
File metadata and controls
35 lines (30 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package pl.commit.craft.flow;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pl.commit.craft.service.CommitTranslateService;
@RestController
@RequestMapping("/api/v1/commit-flow")
public class CommitFlowController {
private final CommitTranslateService commitTranslateService;
public CommitFlowController(CommitTranslateService commitTranslateService) {
this.commitTranslateService = commitTranslateService;
}
@Operation(
summary = "Generate a commit message based on the provided commit flow data",
description = "This endpoint receives commit flow details and generates the corresponding commit message."
)
@PostMapping("/craft")
public String generateCommit(@RequestBody CommitFlowRequest commitFlowRequest) {
return commitTranslateService.generateFlowCommit(
commitFlowRequest.major(),
commitFlowRequest.type(),
commitFlowRequest.component(),
commitFlowRequest.changeDescription(),
commitFlowRequest.details(),
commitFlowRequest.wholeGitCommand()
);
}
}