The serverless API for our final software engineering project.

notion.ts 560B

123456789101112131415161718192021222324
  1. import { NOTION_KEY } from "../config";
  2. import { DatabaseType } from "../types";
  3. const { Client } = require("@notionhq/client");
  4. export const notion = new Client({ auth: NOTION_KEY });
  5. /**
  6. * Translates incoming GET parameters into a valid block ID.
  7. * @param type
  8. * @returns string
  9. */
  10. export function getDatabaseId(type: DatabaseType): string | undefined {
  11. switch (type) {
  12. case "laws":
  13. return "d02fa51eda254c9fa4b97e5f9beb1a86";
  14. case "advice":
  15. return "9515c0f02e454e968c44336bd1beb463";
  16. default:
  17. return undefined;
  18. }
  19. }