Skip to content

Commit

Permalink
[Fix] Add logging to endpoints where it was missing (#3396)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipperolet authored Jan 23, 2024
1 parent 2cee4ed commit d622065
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions front/pages/api/v1/w/[wId]/data_sources/[name]/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Authenticator, getAPIKey } from "@app/lib/auth";
import { parse_payload } from "@app/lib/http_utils";
import { Provider } from "@app/lib/models";
import logger from "@app/logger/logger";
import { apiError } from "@app/logger/withlogging";
import { apiError, withLogging } from "@app/logger/withlogging";

export type DatasourceSearchQuery = {
query: string;
Expand Down Expand Up @@ -50,7 +50,7 @@ type DatasourceSearchResponseBody = {
documents: Array<DocumentType>;
};

export default async function handler(
async function handler(
req: NextApiRequest,
res: NextApiResponse<DatasourceSearchResponseBody | ReturnedAPIErrorType>
): Promise<void> {
Expand Down Expand Up @@ -164,3 +164,5 @@ export default async function handler(
});
}
}

export default withLogging(handler);
6 changes: 4 additions & 2 deletions front/pages/api/v1/w/[wId]/data_sources/[name]/tokenize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { getDataSource } from "@app/lib/api/data_sources";
import { Authenticator, getAPIKey } from "@app/lib/auth";
import logger from "@app/logger/logger";
import { apiError } from "@app/logger/withlogging";
import { apiError, withLogging } from "@app/logger/withlogging";

export type PostDatasourceTokenizeBody = {
text: string;
Expand All @@ -23,7 +23,7 @@ type PostDatasourceTokenizeResponseBody = {
tokens: CoreAPITokenType[];
};

export default async function handler(
async function handler(
req: NextApiRequest,
res: NextApiResponse<
PostDatasourceTokenizeResponseBody | ReturnedAPIErrorType
Expand Down Expand Up @@ -104,3 +104,5 @@ export default async function handler(
});
}
}

export default withLogging(handler);
6 changes: 4 additions & 2 deletions front/pages/api/w/[wId]/data_sources/[name]/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getDataSource } from "@app/lib/api/data_sources";
import { Authenticator, getSession } from "@app/lib/auth";
import { parse_payload } from "@app/lib/http_utils";
import logger from "@app/logger/logger";
import { apiError } from "@app/logger/withlogging";
import { apiError, withLogging } from "@app/logger/withlogging";

export type DatasourceSearchQuery = {
query: string;
Expand Down Expand Up @@ -44,7 +44,7 @@ type DatasourceSearchResponseBody = {
documents: Array<DocumentType>;
};

export default async function handler(
async function handler(
req: NextApiRequest,
res: NextApiResponse<DatasourceSearchResponseBody>
): Promise<void> {
Expand Down Expand Up @@ -170,3 +170,5 @@ export default async function handler(
});
}
}

export default withLogging(handler);

0 comments on commit d622065

Please sign in to comment.