Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangshenghang committed Jan 7, 2025
1 parent c09a158 commit c242776
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.seatunnel.app.service.IJobDefinitionService;
import org.apache.seatunnel.app.service.IJobTaskService;
import org.apache.seatunnel.server.common.CodeGenerateUtils;
import org.apache.seatunnel.server.common.SeatunnelErrorEnum;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down Expand Up @@ -60,7 +61,11 @@ Result<Long> createJobDefinition(
@ApiParam(value = "userId", required = true) @RequestAttribute("userId") Integer userId,
@RequestBody JobReq jobReq)
throws CodeGenerateUtils.CodeGenerateException {
return Result.success(jobService.createJob(userId, jobReq));
if (jobService.getJob(jobReq.getName()).isEmpty()) {
return Result.success(jobService.createJob(userId, jobReq));
} else {
return Result.failure(SeatunnelErrorEnum.TASK_NAME_ALREADY_EXISTS);
}
}

@GetMapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public enum SeatunnelErrorEnum {
MISSING_PARAM(1777000, "param miss [{0}]", "param miss [{0}]"),
PARAM_CAN_NOT_BE_NULL(60018, "", "param [%s] can not be null or empty"),
INVALID_PARAM(60019, "", "param [%s] is invalid. %s"),
TASK_NAME_ALREADY_EXISTS(60020, "task name already exists", "task [%s] already exists"),
RESOURCE_NOT_FOUND(404, "", "%s"),
;

Expand Down

0 comments on commit c242776

Please sign in to comment.