Skip to content

Commit a6b3bda

Browse files
authored
Merge pull request #1777 from lowcoder-org/fix/myorg
myorg endpoint
2 parents 3d063e2 + 10cf573 commit a6b3bda

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/organization/repository/OrganizationRepository.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public interface OrganizationRepository extends ReactiveMongoRepository<Organiza
3333

3434
Flux<Organization> findByOrganizationDomainIsNotNull();
3535
Mono<Boolean> existsBySlug(String slug);
36-
37-
Flux<Organization> findByIdInAndNameContainingIgnoreCase(List<String> ids, String name, Pageable pageable);
38-
Mono<Long> countByIdInAndNameContainingIgnoreCase(List<String> ids, String name);
36+
Flux<Organization> findByIdInAndNameContainingIgnoreCaseAndState(List<String> ids, String name, OrganizationState state, Pageable pageable);
37+
Mono<Long> countByIdInAndNameContainingIgnoreCaseAndState(List<String> ids, String name, OrganizationState state);
3938
}

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/organization/service/OrganizationServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public Flux<Organization> findUserOrgs(String userId, String orgName, Pageable p
330330
if (orgIds.isEmpty()) {
331331
return Flux.empty();
332332
}
333-
return repository.findByIdInAndNameContainingIgnoreCase(orgIds, orgName, pageable);
333+
return repository.findByIdInAndNameContainingIgnoreCaseAndState(orgIds, orgName, ACTIVE, pageable);
334334
});
335335
}
336336

@@ -344,7 +344,7 @@ public Mono<Long> countUserOrgs(String userId, String orgName) {
344344
if (orgIds.isEmpty()) {
345345
return Mono.just(0L);
346346
}
347-
return repository.countByIdInAndNameContainingIgnoreCase(orgIds, filter);
347+
return repository.countByIdInAndNameContainingIgnoreCaseAndState(orgIds, filter, ACTIVE);
348348
});
349349
}
350350
}

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/usermanagement/UserController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.lowcoder.sdk.config.CommonConfig;
2424
import org.lowcoder.sdk.constants.AuthSourceConstants;
2525
import org.lowcoder.sdk.exception.BizError;
26+
import org.springframework.data.domain.Sort;
2627
import org.springframework.http.HttpStatus;
2728
import org.springframework.http.codec.multipart.Part;
2829
import org.springframework.web.bind.annotation.*;
@@ -80,7 +81,7 @@ public Mono<ResponseView<?>> getUserOrgs(ServerWebExchange exchange,
8081
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
8182
return sessionUserService.getVisitor()
8283
.flatMap(user -> {
83-
Pageable pageable = PageRequest.of(pageNum - 1, pageSize);
84+
Pageable pageable = PageRequest.of(pageNum - 1, pageSize, Sort.by(Sort.Direction.DESC, "updatedAt"));
8485
String filter = orgName == null ? "" : orgName;
8586
return organizationService.findUserOrgs(user.getId(), filter, pageable)
8687
.map(OrgView::new)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy