-
Notifications
You must be signed in to change notification settings - Fork 66
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
EPMRPP-90460 implement Organization Project endpoint #2004
Conversation
grabsefx
commented
Jun 5, 2024
- add support of swagger code autogeneration
- implemented Organization Project GET endpoint
import com.epam.ta.reportportal.ws.BaseMvcTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** |
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.
Summary javadoc is missing.
import org.springframework.security.oauth2.provider.OAuth2Authentication; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component("organizationMemberPermission") |
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.
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.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
reviewdog
src/main/java/com/epam/ta/reportportal/ws/controller/OrganizationController.java|107| Line is longer than 100 characters (found 207).
src/main/java/com/epam/ta/reportportal/ws/controller/OrganizationController.java|108| Line is longer than 100 characters (found 174).
src/main/java/com/epam/ta/reportportal/ws/controller/OrganizationController.java|109| Line is longer than 100 characters (found 222).
src/main/java/com/epam/ta/reportportal/core/project/impl/OrganizationProjectHandlerImpl.java|40 col 1| Missing a Javadoc comment.
src/main/java/com/epam/ta/reportportal/core/project/OrganizationProjectHandler.java|24 col 1| Missing a Javadoc comment.
ReportPortalUser rpUser = (ReportPortalUser) oauth.getUserAuthentication().getPrincipal(); | ||
BusinessRule.expect(rpUser, Objects::nonNull).verify(ErrorType.ACCESS_DENIED); | ||
|
||
var ou = organizationUserRepository.findByUserIdAndOrganization_Id(rpUser.getUserId(), (Long) orgId); |
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.
Line is longer than 100 characters (found 105).
@@ -109,4 +115,16 @@ public static MultiValuedMap<String, MultipartFile> getUploadedFiles(HttpServlet | |||
} | |||
return uploadedFiles; | |||
} | |||
|
|||
public static Direction parseSortDirection(String order) { |
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.
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController |
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.
* @param order The order in which to sort the result set. Can be 'asc' for ascending order or | ||
* 'desc' for descending order. | ||
* @return A ResponseEntity containing a list of projects associated with the specified | ||
* organization. |
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.
Line continuation have incorrect indentation level, expected level should be 4.
*/ | ||
@Transactional(readOnly = true) | ||
@PreAuthorize(ORGANIZATION_MEMBER) | ||
@Operation(summary = "Get organization projects", description = "Get a list of organization projects. ### Authority: - `ADMINISTRATOR` - `MANAGER` - `MEMBER` ### Access level - `ADMINISTRATOR` - no restrictions. - `MANAGER` - no restrictions. - `MEMBER` - restricted to viewing only their assigned projects.", security = { |
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.
Line is longer than 100 characters (found 328).
@SecurityRequirement(name = "BearerAuth")}, tags = {"Organizations", "Ready for implementation"}) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = OrganizationProfilesList.class))), | ||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Problem.class))), |
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.
Line is longer than 100 characters (found 172).
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = OrganizationProfilesList.class))), | ||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Problem.class))), | ||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Problem.class)))}) |
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.
Line is longer than 100 characters (found 174).
produces = {"application/json"}, | ||
method = RequestMethod.GET) | ||
public ResponseEntity<OrganizationProfilesList> getOrganizations( | ||
@Parameter(in = ParameterIn.QUERY, description = "The offset used for this page of results", schema = @Schema(defaultValue = "0")) @Valid @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, |
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.
Line is longer than 100 characters (found 229).
method = RequestMethod.GET) | ||
public ResponseEntity<OrganizationProfilesList> getOrganizations( | ||
@Parameter(in = ParameterIn.QUERY, description = "The offset used for this page of results", schema = @Schema(defaultValue = "0")) @Valid @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, | ||
@Parameter(in = ParameterIn.QUERY, description = "The limit used for this page of results. This will be the same as the limit query parameter unless it exceeded the maximum value allowed for this API endpoint", schema = @Schema(defaultValue = "10")) @Valid @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit, |
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.
Line is longer than 100 characters (found 347).
public ResponseEntity<OrganizationProfilesList> getOrganizations( | ||
@Parameter(in = ParameterIn.QUERY, description = "The offset used for this page of results", schema = @Schema(defaultValue = "0")) @Valid @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, | ||
@Parameter(in = ParameterIn.QUERY, description = "The limit used for this page of results. This will be the same as the limit query parameter unless it exceeded the maximum value allowed for this API endpoint", schema = @Schema(defaultValue = "10")) @Valid @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit, | ||
@Parameter(in = ParameterIn.QUERY, description = "Indicate sort by field", schema = @Schema()) @Valid @RequestParam(value = "sort", required = false) String sort, |
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.
Line is longer than 100 characters (found 168).
ReportPortalUser rpUser = (ReportPortalUser) oauth.getUserAuthentication().getPrincipal(); | ||
BusinessRule.expect(rpUser, Objects::nonNull).verify(ErrorType.ACCESS_DENIED); | ||
|
||
organizationRepositoryCustom.findById((Long) orgId).orElseThrow(() -> new ReportPortalException(ErrorType.ORGANIZATION_NOT_FOUND, orgId)); |
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.
Line is longer than 100 characters (found 142).
method = RequestMethod.GET) | ||
public ResponseEntity<OrganizationProjectsList> getOrganizationsOrgIdProjects( | ||
@Parameter(in = ParameterIn.PATH, description = "Organization identifier", required = true, schema = @Schema()) @PathVariable("org_id") Long orgId, | ||
@Parameter(in = ParameterIn.QUERY, description = "The limit used for this page of results. This will be the same as the limit query parameter unless it exceeded the maximum value allowed for this API endpoint", schema = @Schema(defaultValue = "300")) @Valid @RequestParam(value = "limit", required = false, defaultValue = "300") Integer limit, |
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.
Line is longer than 100 characters (found 349).
@Parameter(in = ParameterIn.PATH, description = "Organization identifier", required = true, schema = @Schema()) @PathVariable("org_id") Long orgId, | ||
@Parameter(in = ParameterIn.QUERY, description = "The limit used for this page of results. This will be the same as the limit query parameter unless it exceeded the maximum value allowed for this API endpoint", schema = @Schema(defaultValue = "300")) @Valid @RequestParam(value = "limit", required = false, defaultValue = "300") Integer limit, | ||
@Parameter(in = ParameterIn.QUERY, description = "The offset used for this page of results", schema = @Schema(defaultValue = "0")) @Valid @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, | ||
@Parameter(in = ParameterIn.QUERY, description = "Indicate sorting direction", schema = @Schema(allowableValues = {"ASC", "DESC"}, defaultValue = "ASC")) @Valid @RequestParam(value = "order", required = false, defaultValue = "ASC") String order, |
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.
Line is longer than 100 characters (found 251).
@Parameter(in = ParameterIn.QUERY, description = "Indicate sorting direction", schema = @Schema(allowableValues = {"ASC", "DESC"}, defaultValue = "ASC")) @Valid @RequestParam(value = "order", required = false, defaultValue = "ASC") String order, | ||
@Parameter(in = ParameterIn.QUERY, description = "Filter projects by name", schema = @Schema()) @Valid @RequestParam(value = "name", required = false) String name, | ||
@Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Parameter(in = ParameterIn.QUERY, description = "Filter projects by slug", schema = @Schema()) @Valid @RequestParam(value = "slug", required = false) String slug, | ||
@Parameter(in = ParameterIn.QUERY, description = "Indicate sort by field", schema = @Schema(defaultValue = "name")) @Valid @RequestParam(value = "sort", required = false, defaultValue = "name") String sort, |
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.
Line is longer than 100 characters (found 212).
@Operation(summary = "Get organization information", description = "Provide organization information. ### Authority: - `ADMINISTRATOR` - `MANAGER` - `MEMBER`", security = { | ||
@SecurityRequirement(name = "BearerAuth")}, tags = {"Organizations", "Ready for implementation"}) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = OrganizationProfile.class))), |
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.
Line is longer than 100 characters (found 175).
@Parameter(in = ParameterIn.QUERY, description = "The offset used for this page of results", schema = @Schema(defaultValue = "0")) @Valid @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, | ||
@Parameter(in = ParameterIn.QUERY, description = "The limit used for this page of results. This will be the same as the limit query parameter unless it exceeded the maximum value allowed for this API endpoint", schema = @Schema(defaultValue = "300")) @Valid @RequestParam(value = "limit", required = false, defaultValue = "300") Integer limit, | ||
@Parameter(in = ParameterIn.QUERY, description = "Indicate sorting direction", schema = @Schema(allowableValues = {"ASC", "DESC"}, defaultValue = "ASC")) @Valid @RequestParam(value = "order", required = false, defaultValue = "ASC") String order, | ||
@Parameter(in = ParameterIn.QUERY, description = "Filter organizations by name", schema = @Schema()) @Valid @RequestParam(value = "name", required = false) String name, |
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.
Line is longer than 100 characters (found 174).
@Parameter(in = ParameterIn.QUERY, description = "The limit used for this page of results. This will be the same as the limit query parameter unless it exceeded the maximum value allowed for this API endpoint", schema = @Schema(defaultValue = "300")) @Valid @RequestParam(value = "limit", required = false, defaultValue = "300") Integer limit, | ||
@Parameter(in = ParameterIn.QUERY, description = "Indicate sorting direction", schema = @Schema(allowableValues = {"ASC", "DESC"}, defaultValue = "ASC")) @Valid @RequestParam(value = "order", required = false, defaultValue = "ASC") String order, | ||
@Parameter(in = ParameterIn.QUERY, description = "Filter organizations by name", schema = @Schema()) @Valid @RequestParam(value = "name", required = false) String name, | ||
@Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Parameter(in = ParameterIn.QUERY, description = "Filter organizations by slug", schema = @Schema()) @Valid @RequestParam(value = "slug", required = false) String slug, |
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.
Line is longer than 100 characters (found 222).
@Parameter(in = ParameterIn.QUERY, description = "Indicate sorting direction", schema = @Schema(allowableValues = {"ASC", "DESC"}, defaultValue = "ASC")) @Valid @RequestParam(value = "order", required = false, defaultValue = "ASC") String order, | ||
@Parameter(in = ParameterIn.QUERY, description = "Filter organizations by name", schema = @Schema()) @Valid @RequestParam(value = "name", required = false) String name, | ||
@Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Parameter(in = ParameterIn.QUERY, description = "Filter organizations by slug", schema = @Schema()) @Valid @RequestParam(value = "slug", required = false) String slug, | ||
@Parameter(in = ParameterIn.QUERY, description = "Indicate sort by field", schema = @Schema(defaultValue = "name")) @Valid @RequestParam(value = "sort", required = false, defaultValue = "name") String sort, |
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.
Line is longer than 100 characters (found 212).
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service |
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.
private OrganizationConverter() { | ||
//static only | ||
} | ||
public interface OrganizationProjectHandler { |
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.
private final OrganizationRepositoryCustom organizationRepositoryCustom; | ||
|
||
|
||
@Autowired |
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.
Can be used @requiredargsconstructor from lombok to clean up code