mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 19:29:17 +01:00
* feat(pihole): add support for v6 * fix: add session-store to keep using same session for pi-hole requests * chore: address pull request feedback * fix: import issue * fix: other import errors
24 lines
849 B
TypeScript
24 lines
849 B
TypeScript
import dayjs from "dayjs";
|
|
|
|
import type { IntegrationKindByCategory } from "@homarr/definitions";
|
|
import { createIntegrationAsync } from "@homarr/integrations";
|
|
import type { MediaRequestStats } from "@homarr/integrations/types";
|
|
|
|
import { createCachedIntegrationRequestHandler } from "./lib/cached-integration-request-handler";
|
|
|
|
export const mediaRequestStatsRequestHandler = createCachedIntegrationRequestHandler<
|
|
MediaRequestStats,
|
|
IntegrationKindByCategory<"mediaRequest">,
|
|
Record<string, never>
|
|
>({
|
|
async requestAsync(integration, _input) {
|
|
const integrationInstance = await createIntegrationAsync(integration);
|
|
return {
|
|
stats: await integrationInstance.getStatsAsync(),
|
|
users: await integrationInstance.getUsersAsync(),
|
|
};
|
|
},
|
|
cacheDuration: dayjs.duration(1, "minute"),
|
|
queryKey: "mediaRequestStats",
|
|
});
|