feat: set up mock data to be used to generate baseline profiles

This commit is contained in:
2025-12-06 07:27:14 -05:00
parent 9d71199943
commit ad26cd6da3
9 changed files with 239 additions and 62 deletions

View File

@@ -49,6 +49,17 @@ export function fetchEpisodes(aniListId: number, shouldRetry: boolean = false) {
app.openapi(route, async (c) => {
const aniListId = Number(c.req.param("aniListId"));
// Check if we should use mock data
const { useMockData } = await import("~/libs/useMockData");
if (useMockData()) {
const { mockEpisodes } = await import("~/mocks/mockData");
return c.json({
success: true,
result: { providerId: "aniwatch", episodes: mockEpisodes() },
});
}
const episodes = await fetchEpisodes(aniListId);
if (episodes.length === 0) {
return c.json(ErrorResponse, { status: 404 });

View File

@@ -120,6 +120,14 @@ app.openapi(route, async (c) => {
return c.json(ErrorResponse, { status: 400 });
}
// Check if we should use mock data
const { useMockData } = await import("~/libs/useMockData");
if (useMockData()) {
const { mockEpisodeUrl } = await import("~/mocks/mockData");
return c.json({ success: true, result: mockEpisodeUrl });
}
try {
console.log(
`Fetching episode URL for aniListId: ${aniListId}, episodeNumber: ${episodeNumber}`,