Skip to content

Commit

Permalink
use dataSourceViews
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier committed Aug 9, 2024
1 parent fd04817 commit addc829
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions front/pages/api/w/[wId]/vaults/[vId]/data_sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { DataSourceResource } from "@app/lib/resources/data_source_resource";
import { VaultResource } from "@app/lib/resources/vault_resource";
import { apiError } from "@app/logger/withlogging";

export type GetVaultDataSourcesResponseBody = {
dataSources: ResourceInfo[];
export type GetVaultDataSourceViewsResponseBody = {
dataSourceViews: ResourceInfo[];
};

export const getDataSourceCategory = (
Expand Down Expand Up @@ -45,7 +45,9 @@ export const getDataSourceInfos = async (

async function handler(
req: NextApiRequest,
res: NextApiResponse<WithAPIErrorResponse<GetVaultDataSourcesResponseBody>>,
res: NextApiResponse<
WithAPIErrorResponse<GetVaultDataSourceViewsResponseBody>
>,
auth: Authenticator
): Promise<void> {
const owner = auth.workspace();
Expand Down Expand Up @@ -84,7 +86,7 @@ async function handler(
const all = await getDataSourceInfos(auth, vault);

res.status(200).json({
dataSources: all.filter(
dataSourceViews: all.filter(
(dataSourceInfo) => !category || dataSourceInfo.category === category
),
});
Expand Down

0 comments on commit addc829

Please sign in to comment.