Skip to content
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

Merged
merged 7 commits into from
Jun 10, 2024

Conversation

grabsefx
Copy link
Contributor

@grabsefx grabsefx commented Jun 5, 2024

  • add support of swagger code autogeneration
  • implemented Organization Project GET endpoint

@grabsefx grabsefx requested a review from avarabyeu as a code owner June 5, 2024 08:52
import com.epam.ta.reportportal.ws.BaseMvcTest;
import org.junit.jupiter.api.Test;

/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck> reported by reviewdog 🐶
Summary javadoc is missing.

import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.stereotype.Component;

@Component("organizationMemberPermission")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
@reportportal reportportal deleted a comment from github-actions bot Jun 5, 2024
Copy link

@github-actions github-actions bot left a 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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck> reported by reviewdog 🐶
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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagContinuationIndentationCheck> reported by reviewdog 🐶
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 = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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))),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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)))})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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))),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 100 characters (found 212).

import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

private OrganizationConverter() {
//static only
}
public interface OrganizationProjectHandler {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

@grabsefx grabsefx self-assigned this Jun 10, 2024
private final OrganizationRepositoryCustom organizationRepositoryCustom;


@Autowired
Copy link
Collaborator

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

@grabsefx grabsefx merged commit 60ab456 into feature/orgs Jun 10, 2024
6 of 7 checks passed
@grabsefx grabsefx deleted the EPMRPP-90460 branch June 10, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants