Skip to content

Added get api for libraryquery object for import/export feature in EE #1573

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

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
public interface LibraryQueryApiService {
Mono<List<LibraryQueryView>> listLibraryQueries(String name);

Mono<LibraryQueryView> get(String libraryQueryId);

Mono<LibraryQueryView> create(LibraryQuery libraryQuery);

Mono<Boolean> update(String libraryQueryId, UpsertLibraryQueryRequest upsertLibraryQueryRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ private Flux<LibraryQuery> getByOrgIdWithDatasourcePermissions(String orgId) {
set -> set.contains(libraryQuery.getQuery().getDatasourceId())));
}

@Override
public Mono<LibraryQueryView> get(String libraryQueryId) {
return libraryQueryService.getById(libraryQueryId)
.zipWhen(lb -> userService.findById(lb.getCreatedBy()))
.map(tuple -> LibraryQueryView.from(tuple.getT1(), tuple.getT2()));
}

@Override
public Mono<LibraryQueryView> create(LibraryQuery libraryQuery) {
return checkLibraryQueryManagementPermission(libraryQuery)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public Mono<PageResponseView<?>> list(@RequestParam(required = false, defaultVal
return fluxToPageResponseView(pageNum, pageSize, flux);
}

@Override
public Mono<ResponseView<LibraryQueryView>> get(@PathVariable String libraryQueryId) {
return libraryQueryApiService.get(libraryQueryId)
.map(ResponseView::success);
}

@Override
public Mono<ResponseView<LibraryQueryView>> create(@RequestBody LibraryQuery libraryQuery) {
return libraryQueryApiService.create(libraryQuery)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ public Mono<PageResponseView<?>> list(@RequestParam(required = false, defaultVal
@RequestParam(required = false, defaultValue = "1") int pageNum,
@RequestParam(required = false, defaultValue = "100") int pageSize);

@Operation(
tags = TAG_LIBRARY_QUERY_MANAGEMENT,
operationId = "getLibraryQuery",
summary = "Get a Library By Id",
description = "Get a Library Query by Id."
)
@GetMapping("/{libraryQueryId}")
public Mono<ResponseView<LibraryQueryView>> get(@PathVariable String libraryQueryId);

@Operation(
tags = TAG_LIBRARY_QUERY_MANAGEMENT,
operationId = "createLibraryQuery",
Expand Down
Loading