-
Notifications
You must be signed in to change notification settings - Fork 66
TMS Migration (to feature/orgs) #2209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/orgs
Are you sure you want to change the base?
Changes from 11 commits
3937229
ed0640d
7942b9b
423fdb4
2b794bd
169269d
b474a6f
ad331c3
432f67b
9db8ecc
815e85a
9848ef3
01de53c
a37b5c5
035eb65
5650bd4
a1c4e73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ hs_err_pid* | |
build/ | ||
.gradle/ | ||
out/ | ||
src/test/resources/db/migration/*.sql |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.epam.ta.reportportal.core.tms.controller; | ||
|
||
import static com.epam.ta.reportportal.auth.permissions.Permissions.IS_ADMIN; | ||
|
||
import com.epam.ta.reportportal.core.tms.dto.ProductVersionRQ; | ||
import com.epam.ta.reportportal.core.tms.dto.TmsProductVersionRS; | ||
import com.epam.ta.reportportal.core.tms.service.ProductVersionService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* Controller for managing product versions within a project. Each endpoint | ||
* in this controller is secured and requires the user to have administrator | ||
* privileges. Operations supported include creating, retrieving, updating, | ||
* and deleting product versions associated with a specific project. | ||
*/ | ||
@RestController | ||
@RequestMapping("/project/{projectId}/tms/productversion") | ||
@Tag(name = "Product Version", description = "Product Version API collection") | ||
@RequiredArgsConstructor | ||
public class ProductVersionController { | ||
|
||
private final ProductVersionService productVersionService; | ||
|
||
/** | ||
* Retrieves a specific product version by its ID within a project. | ||
* | ||
* @param projectId The ID of the project to which the product version belongs. | ||
* @param productVersionId The ID of the product version to retrieve. | ||
* @return A data transfer object ({@link TmsProductVersionRS}) containing details of the product version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@GetMapping("/{productVersionId}") | ||
TmsProductVersionRS getById(@PathVariable("projectId") final long projectId, | ||
@PathVariable("productVersionId") final long productVersionId) { | ||
return productVersionService.getById(projectId, productVersionId); | ||
} | ||
|
||
/** | ||
* Creates a new product version in the specified project. | ||
* | ||
* @param projectId The ID of the project to which the new product version will be added. | ||
* @param inputDto A request payload ({@link ProductVersionRQ}) containing information | ||
* about the product version to create. | ||
* @return A data transfer object ({@link TmsProductVersionRS}) with details of the created product version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@PostMapping | ||
TmsProductVersionRS createVersion(@PathVariable("projectId") final long projectId, | ||
@RequestBody final ProductVersionRQ inputDto) { | ||
return productVersionService.create(projectId, inputDto); | ||
} | ||
|
||
/** | ||
* Updates the details of an existing product version in a project. | ||
* | ||
* @param projectId The ID of the project to which the product version belongs. | ||
* @param productVersionId The ID of the product version to update. | ||
* @param inputDto A request payload ({@link ProductVersionRQ}) containing updated information | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* for the product version. | ||
* @return A data transfer object ({@link TmsProductVersionRS}) with updated details of the product version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@PutMapping("/{productVersionId}") | ||
TmsProductVersionRS updateVersion(@PathVariable("projectId") final long projectId, | ||
@PathVariable("productVersionId") final long productVersionId, | ||
@RequestBody final ProductVersionRQ inputDto) { | ||
return productVersionService.update(projectId, productVersionId, inputDto); | ||
} | ||
|
||
/** | ||
* Deletes a specific product version from a project. | ||
* | ||
* @param projectId The ID of the project to which the product version belongs. | ||
* @param productVersionId The ID of the product version to delete. | ||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@DeleteMapping("/{productVersionId}") | ||
void deleteVersion(@PathVariable("projectId") final long projectId, | ||
@PathVariable("productVersionId") final long productVersionId) { | ||
productVersionService.delete(projectId, productVersionId); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package com.epam.ta.reportportal.core.tms.controller; | ||
|
||
import static com.epam.ta.reportportal.auth.permissions.Permissions.IS_ADMIN; | ||
|
||
import com.epam.ta.reportportal.core.tms.dto.TmsTestCaseRQ; | ||
import com.epam.ta.reportportal.core.tms.dto.TmsTestCaseRS; | ||
import com.epam.ta.reportportal.core.tms.service.TmsTestCaseService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* Controller for managing test cases associated with a project. All endpoints | ||
* are secured and require administrator privileges. Operations supported | ||
* include retrieval, creation, updating, and patching test cases. | ||
*/ | ||
@RestController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@RequestMapping("/project/{projectId}/tms/test-case") | ||
@Tag(name = "Test Case", description = "Test Case API collection") | ||
@RequiredArgsConstructor | ||
public class TestCaseController { | ||
|
||
private final TmsTestCaseService tmsTestCaseService; | ||
|
||
/** | ||
* Retrieves a specific test case by its ID within a project. | ||
* | ||
* @param projectId The ID of the project to which the test case belongs. | ||
* @param testCaseId The ID of the test case to retrieve. | ||
* @return A data transfer object ({@link TmsTestCaseRS}) containing details of the test case. | ||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@GetMapping("/{testCaseId}") | ||
public TmsTestCaseRS getTestCaseById(@PathVariable("projectId") final long projectId, | ||
@PathVariable("testCaseId") final long testCaseId) { | ||
return tmsTestCaseService.getById(projectId, testCaseId); | ||
} | ||
|
||
/** | ||
* Retrieves all test cases associated with a specific project. | ||
* | ||
* @param projectId The ID of the project. | ||
* @return A list of data transfer objects ({@link TmsTestCaseRS}) representing test cases. | ||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@GetMapping | ||
public List<TmsTestCaseRS> getTestCaseByProjectId( | ||
@PathVariable("projectId") final long projectId) { | ||
return tmsTestCaseService.getTestCaseByProjectId(projectId); | ||
} | ||
|
||
/** | ||
* Creates a new test case within a specific project. | ||
* | ||
* @param projectId The ID of the project to which the new test case will be added. | ||
* @param inputDto A request payload ({@link TmsTestCaseRQ}) containing information about the test case to create. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* @return A data transfer object ({@link TmsTestCaseRS}) with details of the created test case. | ||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@PostMapping | ||
public TmsTestCaseRS createTestCase(@PathVariable("projectId") final long projectId, | ||
@RequestBody @Valid final TmsTestCaseRQ inputDto) { | ||
return tmsTestCaseService.create(projectId, inputDto); | ||
} | ||
|
||
/** | ||
* Updates the details of an existing test case in a project. | ||
* | ||
* @param projectId The ID of the project to which the test case belongs. | ||
* @param testCaseId The ID of the test case to update. | ||
* @param inputDto A request payload ({@link TmsTestCaseRQ}) containing updated information for the test case. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* @return A data transfer object ({@link TmsTestCaseRS}) with updated details of the test case. | ||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@PutMapping("/{testCaseId}") | ||
public TmsTestCaseRS updateTestCase(@PathVariable("projectId") final long projectId, | ||
@PathVariable("testCaseId") final long testCaseId, | ||
@RequestBody final TmsTestCaseRQ inputDto) { | ||
return tmsTestCaseService.update(projectId, testCaseId, inputDto); | ||
} | ||
|
||
/** | ||
* Applies a set of modifications to an existing test case in a project. | ||
* Partial updates to the test case's fields can be handled via this endpoint. | ||
* | ||
* @param projectId The ID of the project to which the test case belongs. | ||
* @param testCaseId The ID of the test case to patch. | ||
* @param inputDto A request payload ({@link TmsTestCaseRQ}) containing the modifications. | ||
* @return A data transfer object ({@link TmsTestCaseRS}) with patched details of the test case. | ||
*/ | ||
@PreAuthorize(IS_ADMIN) | ||
@PatchMapping("/{testCaseId}") | ||
public TmsTestCaseRS patchTestCase(@PathVariable("projectId") final long projectId, | ||
@PathVariable("testCaseId") final long testCaseId, | ||
@RequestBody final TmsTestCaseRQ inputDto) { | ||
return tmsTestCaseService.patch(projectId, testCaseId, inputDto); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a Javadoc comment.