Skip to content

Commit

Permalink
feat: Adjust get sites query - EXO-66028 - Meeds-io/MIPs#72
Browse files Browse the repository at this point in the history
  • Loading branch information
azayati committed Sep 7, 2023
1 parent c424b87 commit a3c5461
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.exoplatform.social.rest.impl.site;

import java.util.Arrays;
import java.util.List;

import javax.annotation.security.RolesAllowed;
Expand Down Expand Up @@ -65,9 +66,9 @@ public SiteRest(LayoutService layoutService) {
@ApiResponse(responseCode = "500", description = "Internal server error"), })
public Response getSites(@Context
HttpServletRequest request,
@Parameter(description = "Portal site type, possible values: PORTAL, GROUP or USER", required = true)
@QueryParam("siteType")
String siteTypeName,
@Parameter(description = "Portal site types, possible values: PORTAL, GROUP or USER", required = true)
@QueryParam("siteTypes")
String siteTypeNames,
@Parameter(description = "Site name to be excluded")
@QueryParam("excludedSiteName")
String excludedSiteName,
Expand Down Expand Up @@ -97,8 +98,9 @@ public Response getSites(@Context
int limit) {
try {
SiteFilter siteFilter = new SiteFilter();
if (siteTypeName != null) {
siteFilter.setSiteType(SiteType.valueOf(siteTypeName.toUpperCase()));
if (siteTypeNames != null) {
List<SiteType> siteTypes = Arrays.asList(siteTypeNames.split(",")).stream().map(siteTypeName -> SiteType.valueOf(siteTypeName.toUpperCase())).toList();
siteFilter.setSiteTypes(siteTypes);
}
if (excludedSiteName != null) {
siteFilter.setExcludedSiteName(excludedSiteName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function getSites(siteType, excludedSiteName, expandNavigations, displayed, allSites, filterByPermissions) {
export function getSites(siteTypes, excludedSiteName, expandNavigations, displayed, allSites, filterByPermissions) {
const formData = new FormData();
if (siteType) {
formData.append('siteType', siteType);
if (siteTypes) {
formData.append('siteTypes', siteTypes);
}
if (excludedSiteName) {
formData.append('excludedSiteName', excludedSiteName);
Expand Down

0 comments on commit a3c5461

Please sign in to comment.