From e209379f41d3d26ab958d379d3b7404f770c4026 Mon Sep 17 00:00:00 2001 From: Phan Huy Tran Date: Wed, 25 Sep 2024 12:58:28 +0200 Subject: [PATCH] Order files --- .../lf8_starter/project/GetProjectDto.java | 43 ------------------- .../project/dto/CreateProjectAction.java | 42 ------------------ 2 files changed, 85 deletions(-) delete mode 100644 src/main/java/de/szut/lf8_starter/project/GetProjectDto.java delete mode 100644 src/main/java/de/szut/lf8_starter/project/dto/CreateProjectAction.java diff --git a/src/main/java/de/szut/lf8_starter/project/GetProjectDto.java b/src/main/java/de/szut/lf8_starter/project/GetProjectDto.java deleted file mode 100644 index 86ce087..0000000 --- a/src/main/java/de/szut/lf8_starter/project/GetProjectDto.java +++ /dev/null @@ -1,43 +0,0 @@ -package de.szut.lf8_starter.project; - -import com.fasterxml.jackson.annotation.JsonFormat; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import lombok.Getter; -import lombok.Setter; - -import java.time.LocalDate; -import java.util.List; - -@Getter -@Setter -public class GetProjectDto { - @NotBlank - private String name; - - @NotNull - private long leadingEmployee; - - private List employees; - - @NotNull - private long contractor; - - @NotBlank - private String contractorName; - - @NotBlank - private String comment; - - @NotNull - @JsonFormat(pattern = "dd.MM.yyyy") - private LocalDate startDate; - - @NotNull - @JsonFormat(pattern = "dd.MM.yyyy") - private LocalDate plannedEndDate; - - @NotNull - @JsonFormat(pattern = "dd.MM.yyyy") - private LocalDate endDate; -} diff --git a/src/main/java/de/szut/lf8_starter/project/dto/CreateProjectAction.java b/src/main/java/de/szut/lf8_starter/project/dto/CreateProjectAction.java deleted file mode 100644 index f1c6cdc..0000000 --- a/src/main/java/de/szut/lf8_starter/project/dto/CreateProjectAction.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.szut.lf8_starter.project.dto; - -import de.szut.lf8_starter.project.GetProjectDto; -import de.szut.lf8_starter.project.ProjectEntity; -import de.szut.lf8_starter.project.ProjectMapper; -import de.szut.lf8_starter.project.ProjectService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; -import jakarta.validation.Valid; -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; - -@RestController -@RequestMapping(value = "/projects") -public class CreateProjectAction { - private final ProjectService projectService; - private final ProjectMapper projectMapper; - - public CreateProjectAction(ProjectService projectService, ProjectMapper mappingService) { - this.projectService = projectService; - this.projectMapper = mappingService; - } - - @Operation(summary = "Creates a new Project") - @ApiResponses(value = { - @ApiResponse(responseCode = "201", description = "created project", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = GetProjectDto.class))}), - @ApiResponse(responseCode = "400", description = "invalid JSON posted", content = @Content), - @ApiResponse(responseCode = "401", description = "not authorized", content = @Content)}) - @PostMapping - public GetProjectDto create(@RequestBody @Valid CreateProjectDto createProjectDto) { - ProjectEntity projectEntity = this.projectMapper.mapCreateDtoToEntity(createProjectDto); - - projectEntity = this.projectService.create(projectEntity); - - return this.projectMapper.mapToGetDto(projectEntity); - } -}