Skip to content

Commit

Permalink
Added cancelJob endpoint rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
masoudarvishian committed May 10, 2024
1 parent 3f048f7 commit 061bbd0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/main/java/com/zenjob/challenge/controller/JobController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
Expand All @@ -38,6 +36,18 @@ public ResponseDto<RequestJobResponse> requestJob(@RequestBody @Valid RequestJob
.build();
}

@DeleteMapping(path = "/{id}/cancel")
@ResponseStatus(code = HttpStatus.NO_CONTENT)
public void cancelJob(@PathVariable("id") UUID jobId, @RequestBody @Valid CancelJobRequestDto dto) {
jobService.cancelJob(dto.companyId, jobId);
}

@NoArgsConstructor
@Data
private static class CancelJobRequestDto {
UUID companyId;
}

@NoArgsConstructor
@AllArgsConstructor
@Data
Expand Down

0 comments on commit 061bbd0

Please sign in to comment.