|
4 | 4 | import jakarta.annotation.Nonnull;
|
5 | 5 | import org.lowcoder.domain.application.model.Application;
|
6 | 6 | import org.lowcoder.domain.application.model.ApplicationStatus;
|
| 7 | +import org.springframework.data.mongodb.repository.Aggregation; |
7 | 8 | import org.springframework.data.mongodb.repository.Query;
|
8 | 9 | import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
|
9 | 10 | import org.springframework.stereotype.Repository;
|
|
16 | 17 | public interface ApplicationRepository extends ReactiveMongoRepository<Application, String>, CustomApplicationRepository {
|
17 | 18 |
|
18 | 19 | // publishedApplicationDSL : 0 -> excludes publishedApplicationDSL from the return
|
19 |
| - @Query(fields = "{ publishedApplicationDSL : 0 , editingApplicationDSL : 0 }") |
| 20 | + @Aggregation(pipeline = {"{ $project: { 'editingApplicationDSL.settings.category': 1, _id: 1, gid: 1, organizationId: 1, name: 1, applicationType: 1, applicationStatus: 1, publicToAll: 1, publicToMarketplace: 1, agencyProfile: 1, editingUserId: 1, lastEditedAt: 1, createdAt: 1, updatedAt: 1, createdBy: 1, modifiedBy: 1, _class: 1}}"}) |
20 | 21 | Flux<Application> findByOrganizationId(String organizationId);
|
21 | 22 |
|
22 | 23 |
|
23 | 24 | @Override
|
24 | 25 | @Nonnull
|
25 |
| - @Query(fields = "{ publishedApplicationDSL : 0 , editingApplicationDSL : 0 }") |
| 26 | + @Aggregation(pipeline = {"{ $project: { 'editingApplicationDSL.settings.category': 1, _id: 1, gid: 1, organizationId: 1, name: 1, applicationType: 1, applicationStatus: 1, publicToAll: 1, publicToMarketplace: 1, agencyProfile: 1, editingUserId: 1, lastEditedAt: 1, createdAt: 1, updatedAt: 1, createdBy: 1, modifiedBy: 1, _class: 1}}"}) |
26 | 27 | Mono<Application> findById(@Nonnull String id);
|
27 | 28 |
|
28 |
| - @Query(fields = "{ publishedApplicationDSL : 0 , editingApplicationDSL : 0 }") |
| 29 | + @Aggregation(pipeline = {"{ $project: { 'editingApplicationDSL.settings.category': 1, _id: 1, gid: 1, organizationId: 1, name: 1, applicationType: 1, applicationStatus: 1, publicToAll: 1, publicToMarketplace: 1, agencyProfile: 1, editingUserId: 1, lastEditedAt: 1, createdAt: 1, updatedAt: 1, createdBy: 1, modifiedBy: 1, _class: 1}}"}) |
29 | 30 | Flux<Application> findByGid(@Nonnull String gid);
|
30 | 31 |
|
31 | 32 | Mono<Long> countByOrganizationIdAndApplicationStatus(String organizationId, ApplicationStatus applicationStatus);
|
|
0 commit comments