Skip to content

Commit

Permalink
feat(coral): Add getTopicOverview to topic domain (#1240)
Browse files Browse the repository at this point in the history
feat(coral): Add getTopicOverview to domain

Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
  • Loading branch information
Mathieu Anderson authored May 16, 2023
1 parent 6b245ef commit b91eb0d
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions coral/src/domain/topic/topic-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import omitBy from "lodash/omitBy";
import { Schema } from "src/app/features/topics/request/form-schemas/topic-request-form";
import { transformAdvancedConfigEntries } from "src/app/features/topics/request/utils";
import {
RequestVerdictApproval,
RequestVerdictDecline,
Expand All @@ -15,14 +17,12 @@ import {
TopicRequestApiResponse,
} from "src/domain/topic/topic-types";
import api, { API_PATHS } from "src/services/api";
import { convertQueryValuesToString } from "src/services/api-helper";
import {
KlawApiRequest,
KlawApiRequestQueryParameters,
KlawApiResponse,
} from "types/utils";
import { convertQueryValuesToString } from "src/services/api-helper";
import { Schema } from "src/app/features/topics/request/form-schemas/topic-request-form";
import { transformAdvancedConfigEntries } from "src/app/features/topics/request/utils";

const getTopics = async (
params: KlawApiRequestQueryParameters<"getTopics">
Expand Down Expand Up @@ -204,6 +204,25 @@ const deleteTopicRequest = ({
});
};

const getTopicOverview = ({
topicName,
environmentId,
groupBy,
}: KlawApiRequestQueryParameters<"getTopicOverview">) => {
const queryParams = convertQueryValuesToString({
topicName,
...(environmentId && { environmentId }),
...(groupBy && {
groupBy,
}),
});

return api.get<KlawApiResponse<"getTopicOverview">>(
API_PATHS.getTopicOverview,
new URLSearchParams(queryParams)
);
};

export {
getTopics,
getTopicNames,
Expand All @@ -215,4 +234,5 @@ export {
approveTopicRequest,
declineTopicRequest,
deleteTopicRequest,
getTopicOverview,
};

0 comments on commit b91eb0d

Please sign in to comment.