Compare commits

..

12 commits

Author SHA1 Message Date
279fec4d96
testing....... (Comit needs to be edited later)
All checks were successful
Quality Check / Validate OAS (push) Successful in 36s
Quality Check / Linting (push) Successful in 1m9s
Quality Check / Testing (push) Successful in 1m15s
Quality Check / Static Analysis (push) Successful in 1m17s
Co-authored-by: Rajbir Singh <rajbir.singh@hmmh.de>
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-10 11:19:52 +02:00
154c38c29f
PMT-16: Update Manual Validation Method of Projects to Include the builtin.
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-10 11:19:52 +02:00
0e5229520e
PMT-16: Implement New Endpoint Logic
Co-authored-by: Rajbir Singh <rajbir.singh@hmmh.de>
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-10 11:19:52 +02:00
d8bc3a5608
PMT-16: Add Validation for Time Range to Project Entity
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-10 11:19:52 +02:00
20492ecaef
PMT-16: Add Mapper for Project Creation/Created DTO to/from Project Entity
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-10 11:19:52 +02:00
Rajbir Singh
ec843eb946
PMT-16: Add Method to Check if Project with Name Exists to ProjectRepository 2024-10-10 11:19:52 +02:00
28c5f8bbf3
PMT-16: Add More Errors to Endpoint Specification
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-10 11:19:52 +02:00
Rajbir Singh
397e8dd529
PMT-16: Add Endpoint Specification 2024-10-10 11:19:52 +02:00
1b171cb085 Merge pull request 'PMT-15: Projekte löschen' (!11) from story/PMT-15-projekte-loeschen into trunk
All checks were successful
Quality Check / Validate OAS (push) Successful in 33s
Quality Check / Linting (push) Successful in 1m9s
Quality Check / Static Analysis (push) Successful in 1m15s
Quality Check / Testing (push) Successful in 1m13s
Reviewed-on: #11
2024-10-09 13:14:40 +00:00
2cf79e3568
PMT-15: Implement Tests for Responses
All checks were successful
Quality Check / Validate OAS (push) Successful in 48s
Quality Check / Validate OAS (pull_request) Successful in 1m6s
Quality Check / Linting (push) Successful in 2m4s
Quality Check / Linting (pull_request) Successful in 2m7s
Quality Check / Testing (push) Successful in 2m12s
Quality Check / Static Analysis (push) Successful in 2m22s
Quality Check / Testing (pull_request) Successful in 2m12s
Quality Check / Static Analysis (pull_request) Successful in 2m16s
2024-10-09 11:48:07 +02:00
d725addef8
PMT-15: added api documentation 2024-10-09 11:36:56 +02:00
165aee2ece
PMT-15: Added a deleteProject by ID method 2024-10-09 11:36:56 +02:00
4 changed files with 67 additions and 2 deletions

View file

@ -144,3 +144,28 @@ paths:
$ref: "#/components/responses/InternalError"
503:
$ref: "#/components/responses/ServiceUnavailable"
/project/{id}:
delete:
operationId: "deleteProject"
description: "Delete a specific Project"
parameters:
- in: path
name: id
schema:
type: integer
format: int64
required: true
responses:
204:
description: "Deletes a specific Project"
401:
$ref: "#/components/responses/Unauthorized"
404:
description: "Project not found"
content:
text/plain:
schema:
type: string
500:
$ref: "#/components/responses/InternalError"

View file

@ -110,7 +110,6 @@ tasks {
}
withType<Test> {
useJUnitPlatform()
maxParallelForks = 1
}
named("compileJava").configure {
dependsOn(swaggerSources.getByName("pmt").code)

View file

@ -41,6 +41,16 @@ public class ApiController implements DefaultApi {
return Optional.empty();
}
@Override
public ResponseEntity<Void> deleteProject(Long id) {
if (!projectRepository.existsById(id)) {
return ResponseEntity.notFound().build();
}
projectRepository.deleteById(id);
return ResponseEntity.noContent().build();
}
@Override
public ResponseEntity<GetAllProjectsDTO> getAllProjects() {
GetAllProjectsDTO response = new GetAllProjectsDTO();

View file

@ -0,0 +1,31 @@
package de.hmmh.pmt.project;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import de.hmmh.pmt.IntegrationTest;
import de.hmmh.pmt.db.Project;
public class DeleteTest extends IntegrationTest {
@Test
void projectNotFound() throws Exception {
mvc
.perform(delete(baseUri + "/project/1"))
.andExpect(status().isNotFound())
;
}
@Test
void deletedSuccessfully() throws Exception {
Map<String,Project> allProjects = createTestProjectData();
mvc
.perform(delete(baseUri + "/project/" + allProjects.get("space-station").getId()))
.andExpect(status().isNoContent())
;
}
}