dashpresshq/dashpress

View on GitHub
src/pages/api/integrations/_base/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { integrationsConfigurationApiController } from "@/backend/integrations-configurations/integrations-configurations.controller";
import { requestHandler } from "@/backend/lib/request";
import { UserPermissions } from "@/shared/constants/user";
import type { IntegrationsConfigurationGroup } from "@/shared/types/integrations";

export const integrationsConfigurationListRequestHandler = (
  group: IntegrationsConfigurationGroup
) => {
  return requestHandler(
    {
      GET: async () => {
        return await integrationsConfigurationApiController.list(group);
      },
    },
    [
      {
        _type: "canUser",
        body: UserPermissions.CAN_CONFIGURE_APP,
      },
    ]
  );
};